Longest Substring Without Repeats
Track last-seen positions in a window.
A Classic Window Problem
Find the longest substring with no repeated character. It is a sliding-window favorite that shows up across nearly every judge. 🔤
The Brute-Force Trap
Checking every substring for duplicates costs about O(n^2) or worse. For long strings that is far too slow, so a smarter sweep is needed.
All lessons in this course
- Fixed-Size Window Sums
- Variable Window with Two Pointers
- Longest Substring Without Repeats
- Count Windows That Satisfy a Rule