File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,7 @@ public int lengthOfLongestSubstringKDistinct(String s, int k) {
29
29
num ++;
30
30
}
31
31
if (num > k ) {
32
- while (--count [s .charAt (left ++)] > 0 ) {
33
- }
34
- ;
32
+ while (--count [s .charAt (left ++)] > 0 );
35
33
num --;
36
34
}
37
35
result = Math .max (result , right - left + 1 );
@@ -41,7 +39,7 @@ public int lengthOfLongestSubstringKDistinct(String s, int k) {
41
39
}
42
40
43
41
public static class Solution2 {
44
- /**This is a more generic solution for any characters.*/
42
+ /**This is a more generic solution for any characters, not limited to ASCII characters .*/
45
43
public int lengthOfLongestSubstringKDistinct (String s , int k ) {
46
44
Map <Character , Integer > map = new HashMap <>();
47
45
int longest = 0 ;
You can’t perform that action at this time.
0 commit comments