We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2307542 commit e99ac35Copy full SHA for e99ac35
src/main/java/g3401_3500/s3456_find_special_substring_of_length_k/Solution.java
@@ -1,21 +1,10 @@
1
package g3401_3500.s3456_find_special_substring_of_length_k;
2
3
-// #Easy #2025_02_16_Time_0_ms_(100.00%)_Space_42.05_MB_(100.00%)
+// #Easy #2025_02_16_Time_1_ms_(100.00%)_Space_42.25_MB_(100.00%)
4
5
@SuppressWarnings("java:S1871")
6
public class Solution {
7
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
18
19
int start = 0;
20
int end = k;
21
while (end <= s.length()) {
0 commit comments