← All problems

Longest Repeating Character Replacement

Medium stringssliding-window LeetCode ↗
Longest substring with same letter after at most k replacements.

Hints (0/3 revealed)

Log in to reveal hints progressively.

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.