Longest substring without repeating characters
via2dbi
Problem
Find the length of the longest substring without repeating characters.
Example
"abcabcbb" -> 3 ("abc")
Constraints
- Aim for O(n) time
Approach
Sliding window with a last-seen index map; advance the left edge past any repeat.
asked …