Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 31567b4

Browse files
committed
972 wrong answer
1 parent 97a32d6 commit 31567b4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Algorithms/0972.equal-rational-numbers/equal-rational-numbers.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ func simplify(nonRepeat, repeat string) (string, string) {
6262
}
6363
}
6464

65+
if repeat == "0" {
66+
repeat = ""
67+
}
68+
6569
return nonRepeat, repeat
6670
}
6771

Algorithms/0972.equal-rational-numbers/equal-rational-numbers_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ var tcs = []struct {
1414
}{
1515

1616
{
17-
"1.",
17+
"1.0",
1818
"1",
1919
true,
2020
},
2121

22+
{
23+
"0.(0)",
24+
"0",
25+
true,
26+
},
27+
2228
{
2329
"0.(52)",
2430
"0.5(25)",

0 commit comments

Comments
 (0)