Mark As Completed Discussion

Algorithm for Longest Substring Without Duplicates

The big picture pseudo-code algorithm for finding the longest substring without duplicates is provided here. We'll make the same assumption about the lastPos array as mentioned previously (that it can be indexed by x and lastPos[x] holds the last found occurrence of x in the input string).

The figure below shows the entire process for an example.

Our Algorithm
TEXT
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment