Skip to main content

Sliding window · 5 minutes

Repair a distinct-character window

Get feedback on your answer. No account needed.

You extend a window for the longest substring without repeats. The new character is already in the window. What should you do before recording its length?

Your answer
Need a small hint?

Restore the invariant while keeping as much of the current window as possible.

This helps us choose when to schedule your next review.