Longest Substring Without Repeating Characters
Given a string s, find the length of the longest contiguous substring that contains no repeated characters.
A substring is a contiguous sequence of characters within s. The answer must be the length of the longest such substring where every character appears at most once.
Examples
Input: "abcabcbb"
Output: 3
Input: "bbbbb"
Output: 1
Hints
What property does a substring have when all its characters are unique? Consider what happens as you extend it one character to the right.
When you encounter a character already inside the current window, the next candidate substring begins right after its previous occurrence. Where should you restart your search?
How can you tell whether a character already exists in the current window without scanning the entire window every time?
Longest Substring Without Repeating Characters
Given a string `s`, find the length of the longest contiguous substring that contains no repeated characters.