Files
java-interview-lab/sliding-window/output/02-longest-unique-trace.txt
T

22 lines
977 B
Plaintext

Longest substring without repeating characters
==============================================
input "abcabcbb"
right=0 'a' left=0 window="a" best=1
right=1 'b' left=0 window="ab" best=2
right=2 'c' left=0 window="abc" best=3
right=3 'a' left=1 window="bca" best=3 seen at 0 inside the window, left 0 -> 1
right=4 'b' left=2 window="cab" best=3 seen at 1 inside the window, left 1 -> 2
right=5 'c' left=3 window="abc" best=3 seen at 2 inside the window, left 2 -> 3
right=6 'b' left=5 window="cb" best=3 seen at 4 inside the window, left 3 -> 5
right=7 'b' left=7 window="b" best=3 seen at 6 inside the window, left 5 -> 7
answer = 3
input "abba"
right=0 'a' left=0 window="a" best=1
right=1 'b' left=0 window="ab" best=2
right=2 'b' left=2 window="b" best=2 seen at 1 inside the window, left 0 -> 2
right=3 'a' left=2 window="ba" best=2 seen at 0 but that is left of the window, left stays 2
answer = 2