Longest Substring Without Repeating Characters
MediumSliding Window
Decode it first. Clues, constraints, pattern and plan before any code.Given a string s, return the length of the longest substring that has no repeated characters. A substring is a contiguous run of characters, so "pwke" does not count for "pwwkew".
"abcabcbb" → 3 ("abc")
"bbbbb" → 1 ("b")
"pwwkew" → 3 ("wke")Constraints
0 <= s.length <= 5 * 10^4sconsists of English letters, digits, symbols and spaces.