Skip to content

Commit febae71

Browse files
committed
Fixed test
1 parent e8797d0 commit febae71

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/main/java/g3401_3500/s3456_find_special_substring_of_length_k/Solution.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ public boolean hasSpecialSubstring(String s, int k) {
2020
if (flag) {
2121
continue;
2222
}
23-
if (start - 1 >= 0 && s.charAt(start) == s.charAt(start - 1)) {
24-
start++;
25-
end++;
26-
} else if (end < s.length() && s.charAt(end) == s.charAt(end - 1)) {
23+
if (start - 1 >= 0 && s.charAt(start) == s.charAt(start - 1)
24+
|| end < s.length() && s.charAt(end) == s.charAt(end - 1)) {
2725
start++;
2826
end++;
2927
} else {

src/test/java/g3401_3500/s3453_separate_squares_i/SolutionTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ class SolutionTest {
99
@Test
1010
void separateSquares() {
1111
assertThat(
12-
new Solution().separateSquares(new int[][] {{0, 0, 1}, {2, 2, 1}}),
13-
equalTo(1.0));
12+
new Solution().separateSquares(new int[][] {{0, 0, 1}, {2, 2, 1}}), equalTo(1.0));
1413
}
1514

1615
@Test

src/test/java/g3401_3500/s3456_find_special_substring_of_length_k/SolutionTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ void hasSpecialSubstring() {
1515
void hasSpecialSubstring2() {
1616
assertThat(new Solution().hasSpecialSubstring("abc", 2), equalTo(false));
1717
}
18+
19+
@Test
20+
void hasSpecialSubstring3() {
21+
assertThat(new Solution().hasSpecialSubstring("ccc", 2), equalTo(false));
22+
}
1823
}

0 commit comments

Comments
 (0)