Skip to content

Commit e99ac35

Browse files
committed
Fixed sonar
1 parent 2307542 commit e99ac35

File tree

1 file changed

+1
-12
lines changed
  • src/main/java/g3401_3500/s3456_find_special_substring_of_length_k

1 file changed

+1
-12
lines changed

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
package g3401_3500.s3456_find_special_substring_of_length_k;
22

3-
// #Easy #2025_02_16_Time_0_ms_(100.00%)_Space_42.05_MB_(100.00%)
3+
// #Easy #2025_02_16_Time_1_ms_(100.00%)_Space_42.25_MB_(100.00%)
44

55
@SuppressWarnings("java:S1871")
66
public class Solution {
77
public boolean hasSpecialSubstring(String s, int k) {
8-
if (s.length() == k) {
9-
if (k == 1) {
10-
return true;
11-
}
12-
for (int i = 0; i < k - 1; i++) {
13-
if (s.charAt(i) != s.charAt(i + 1)) {
14-
return false;
15-
}
16-
}
17-
return true;
18-
}
198
int start = 0;
209
int end = k;
2110
while (end <= s.length()) {

0 commit comments

Comments
 (0)