Example 1
Input
s = 'abcabcbb'
Output
3
The longest substrings without repeating characters are 'abc' with length 3.
Full lesson preview
Find the length of the longest substring in a given string that contains no repeating characters using the sliding window technique.
Problem statement
Task
Examples
Input
s = 'abcabcbb'
Output
3
The longest substrings without repeating characters are 'abc' with length 3.
Input format
Output format
Constraints
Samples
Input
s = 'pwwkew'
Output
3
The longest substring without repeating characters is 'wke' (or 'kew'), length 3.