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

Commit dc7d6a8

Browse files
committed
984 wrong answer
1 parent 611f7de commit dc7d6a8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Algorithms/0984.string-without-aaa-or-bbb/string-without-aaa-or-bbb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func strWithout3a3b(A int, B int) string {
1717
sb.WriteRune(a)
1818
A--
1919
}
20-
for i := 2; i > 0 && B > 0; i-- {
20+
for i := 2; i > 0 && B > 0 && A-B < 2; i-- {
2121
sb.WriteRune(b)
2222
B--
2323
}

Algorithms/0984.string-without-aaa-or-bbb/string-without-aaa-or-bbb_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ var tcs = []struct {
3838
"bbabbab",
3939
},
4040

41+
{
42+
2,
43+
6,
44+
"bbabbabb",
45+
},
46+
4147
// 可以有多个 testcase
4248
}
4349

0 commit comments

Comments
 (0)