Longest Repeating Character Replacement
Sliding window · Keep a window valid under a budget · Stretch · about 30 min
Why it matters
This sharpens the skill of writing and maintaining a window invariant.
How it connects
The window now permits repeats, but only while the replacement budget can repair them.
Try first
How many replacements are needed to make a window all one character?
Interview cue
The valid-window condition is exactly replacementsNeeded ≤ k.