Step 6 of 6
Challenge: sliding window
A sliding window keeps a range [left, right] that only ever moves forward. Each element enters once and leaves once, so the whole scan is O(n), even though it looks at many ranges.
Your turn: write int longest_unique(const std::string& s): the length of the longest substring with no repeated characters. For "abcabcbb" it's 3 ("abc").
Idea: move right forward one character at a time. If that character already appears inside the window, jump left past its previous position. Remember each character's last position in an array of 256 ints.