Class Solution
- java.lang.Object
-
- g0301_0400.s0395_longest_substring_with_at_least_k_repeating_characters.Solution
-
public class Solution extends Object
395 - Longest Substring with At Least K Repeating Characters.Medium
Given a string
s
and an integerk
, return the length of the longest substring ofs
such that the frequency of each character in this substring is greater than or equal tok
.Example 1:
Input: s = “aaabb”, k = 3
Output: 3
Explanation: The longest substring is “aaa”, as ‘a’ is repeated 3 times.
Example 2:
Input: s = “ababbc”, k = 2
Output: 5
Explanation: The longest substring is “ababb”, as ‘a’ is repeated 2 times and ‘b’ is repeated 3 times.
Constraints:
1 <= s.length <= 104
s
consists of only lowercase English letters.1 <= k <= 105
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
-
-
Method Detail
-
longestSubstring
public int longestSubstring(String s, int k)
-
-