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

Commit 123a6cb

Browse files
committed
972 accepted. 0ms
1 parent d0a7500 commit 123a6cb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
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
@@ -57,6 +57,10 @@ func simplify(nonRepeat, repeat string) (string, string) {
5757
return nonRepeat, repeat
5858
}
5959

60+
if repeat == strings.Repeat(repeat[:1], len(repeat)) {
61+
repeat = repeat[:1]
62+
}
63+
6064
for repeat[:len(repeat)/2] == repeat[len(repeat)/2:] {
6165
repeat = repeat[:len(repeat)/2]
6266
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ var tcs = []struct {
1313
ans bool
1414
}{
1515

16+
{
17+
"350.(111)",
18+
"350.(11)",
19+
true,
20+
},
21+
1622
{
1723
"15.(9)",
1824
"16",

0 commit comments

Comments
 (0)