[LeetCode] Longest Substring with At Least K Repeating Characters 至少有K个重复字符的最长子字符串

Posted Grandyang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LeetCode] Longest Substring with At Least K Repeating Characters 至少有K个重复字符的最长子字符串相关的知识,希望对你有一定的参考价值。

 

Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than k times.

Example 1:

Input:
s = "aaabb", k = 3

Output:
3

The longest substring is "aaa", as ‘a‘ is repeated 3 times.

Example 2:

Input:
s = "ababbc", k = 2

Output:
5

The longest substring is "ababb", as ‘a‘ is repeated 2 times and ‘b‘ is repeated 3 times.

 

s

 

以上是关于[LeetCode] Longest Substring with At Least K Repeating Characters 至少有K个重复字符的最长子字符串的主要内容,如果未能解决你的问题,请参考以下文章

leetcode:longest words

Leetcode409. Longest Palindrome

leetcode:longest-increasing

[Leetcode]Longest Palindromic Substring

leetcode longest consecutive sequence

LeetCode Longest Increasing Subsequence