Loading...
Loading...
Loading...
Given a word of lowercase letters, find the length of the longest block of consecutive letters in which no letter appears twice.
Example
Input
abcabcbb
Output
3
The block abc has length 3, and no longer block exists.
Try the problem first. Open one hint at a time.
Keep a window with no repeated letter, and the position where each letter was last seen.
When the new letter was last seen inside the window, move the start of the window just after that position.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor