Longest Substring Without Repeating Characters
Variable window plus the last index of each character. A repeat inside jumps the left edge past its earlier copy.
Substring Windows: Longest run without a repeat
r = 0, 'a'. Not in the window, so it simply joins. Window "a" of length 1, a new best.
Cost
- Best
- O(n)
- Average
- O(n)
- Worst
- O(n)
- Space
- O(alphabet)
Before this
Taught by the same lesson
Substring Windows covers these too, in the same run.