6
0
:0
0
No-Repeat Window Size
No-Repeat Window Size
Easy
Sliding Window
In "No-Repeat Window Size", given a string s, find the maximum length of a contiguous substring with all unique characters.
Example 1
Input:
s = "abcdeafgh"Output:
8For input s = "abcdeafgh", a longest substring without duplicate characters is "bcdeafgh", so the length is 8. Therefore, return 8.
Example 2
Input:
s = "dvdf"Output:
3For input s = "dvdf", a longest substring without duplicate characters is "vdf", so the length is 3. Therefore, return 3.
Constraints
0 <= s.length <= 5 * 104s may contain letters, digits, symbols, and spaces.
solution.js
Loading...
Test Cases (2)
Test Case 1
Input:
"abcdeafgh"Expected Output:
8Test Case 2
Input:
"dvdf"Expected Output:
3