|
1 | 1 | packagecom.fishercoder.solutions;
|
2 | 2 |
|
3 |
| -/** |
4 |
| - * 395. Longest Substring with At Least K Repeating Characters |
5 |
| - * |
6 |
| - * Find the length of the longest substring T of a given string |
7 |
| - * (consists of lowercase letters only) |
8 |
| - * such that every character in T appears no less than k times. |
9 |
| -
|
10 |
| - Example 1: |
11 |
| - Input: |
12 |
| - s = "aaabb", k = 3 |
13 |
| -
|
14 |
| - Output: |
15 |
| - 3 |
16 |
| -
|
17 |
| - The longest substring is "aaa", as 'a' is repeated 3 times. |
18 |
| -
|
19 |
| -
|
20 |
| - Example 2: |
21 |
| - Input: |
22 |
| - s = "ababbc", k = 2 |
23 |
| -
|
24 |
| - Output: |
25 |
| - 5 |
26 |
| -
|
27 |
| - The longest substring is "ababb", as 'a' is repeated 2 times and 'b' is repeated 3 times. |
28 |
| - */ |
29 |
| - |
30 | 3 | publicclass_395 {
|
31 | 4 | publicstaticclassSolution1 {
|
32 |
| -/**Reference: https://discuss.leetcode.com/topic/57372/java-divide-and-conquer-recursion-solution*/ |
| 5 | +/** |
| 6 | + * Reference: https://discuss.leetcode.com/topic/57372/java-divide-and-conquer-recursion-solution |
| 7 | + */ |
33 | 8 | publicintlongestSubstring(Strings,intk) {
|
34 | 9 | returnfindLongestSubstring(s.toCharArray(),0,s.length(),k);
|
35 | 10 | }
|
|