Sliding WindowMedium

Longest Substring Without Repeating Characters

Return the length of the longest run of characters in s where no character appears twice.

Example 1s = "abcabcbb" → 3"abc" is the longest run with no repeats.
Example 2s = "bbbbb" → 1
0 ≤ length ≤ 5·10⁴ · letters, digits, symbols and spaces

Hints

0 of 3 open
Hint 2 · the patternHint 3 · the key line