← All problems
Longest Repeating Character Replacement
Longest substring with same letter after at most k replacements.
Complexity
Time O(n), Space O(1)
Common pitfalls
- Recomputing max frequency on shrink (unnecessary)
- Confusing with 'at most k distinct'
Your solution
Log in to save your code and track progress.