[LeetCode] 395. Longest Substring with At Least K Repeating Characters
Given a string s and an integer k, return the length of the longest substring of s such that the frequency of each character in this substring is greater than or equal to k.
if no such substring exists, return 0.
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
至少有 K 个重复字符的最长子串。
给你一个字符串 s 和一个整数 k ,请你找出 s 中的最长子串, 要求该子串中的每一字符出现次数都不少于 k 。返回这一子串的长度。