Longest Substring Without Repeating Characters

Sliding window · Grow, then repair a variable window · Stretch · about 24 min

Why it matters

Variable windows are a high-value pattern for substring and subarray questions.

How it connects

Your first window had fixed size. This one grows until a rule breaks, then repairs itself.

Try first

What must always be true inside your current window?

Interview cue

The window invariant is “no duplicates”; each pointer moves at most n times.