PythiloLesson 3 of 32 · progress kept in this browser

Slide a window over the longest unique run

A window is a slice described by two indices. Grow it on the right one character at a time. When the new character is already inside, move the left edge just past its previous position instead of starting over.

last = {}
text = "abcab"
# at index 3, 'a' was seen at 0
# so left moves to 1
Your task

Write longest_unique(text) returning the length of the longest substring with no repeated character.