Tasks /
Algorithms /
Longest substring without repeated characters
Statement
hard
Longest substring without repeated characters
Implement `longest_unique_substring(text)`: the length of the longest substring
without repeated characters.
Example: `"abcabcbb"` → `3` (`"abc"`).
A sliding window is expected: the right edge moves forward, the left edge
catches up when a character repeats. Cover an empty string, a single character,
all-identical characters and Cyrillic.
AI mentor
The AI mentor is available after you log in: it sees your attempt history and does not spend resources on anonymous requests.
Log in and ask
Hints
1 of 3 unlocked · attempts: 0
Hint 1
Keep the window `[left, right]`. What should happen to `left` when the character
on the right is already inside the window?
Hint 2 — unlocks after 1 attempt
Hint 3 — unlocks after 3 attempts