Back to course home
0% completed
Vote For New Content
Solution: Longest Substring with At Least K Repeating Characters - Copy
Problem Statement
Given a string s
and an integer k
, return the maximum length
of the substring where each character appears at least k
times. If no such substring exists, return 0.
Examples
Example 1:
- Input: s =
"aaabbcc"
,k = 2
- Output:
7
- Justification: The longest substring is
"aaabbcc"
, where each character ('a', 'b', and 'c') appears at least 2 times.
Example 2:
- Input: s =
"ababbc"
,k = 3
- Output:
0
- Justification: There is no substring exists having each character frequency at least 3.
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page