Basic example
Input
s = "abcabcbb"
Output
3
The longest substring without repeating characters is "abc", with length 3.
Full lesson preview
Compute the length of the longest substring with all unique characters using a sliding window and index map.
Problem statement
Task
Examples
Input
s = "abcabcbb"
Output
3
The longest substring without repeating characters is "abc", with length 3.
Input format
Output format
Constraints
Samples
Input
s = "bbbbb"
Output
1
The longest substring without repeating characters is "b".