6
0
:0
0
Key Stream Unique Range
Key Stream Unique Range
Medium
Sliding Window
In "Key Stream Unique Range", given a string s, find the maximum length of a contiguous substring with all unique characters.
Example 1
Input:
s = "abba"Output:
2For input s = "abba", a longest substring without duplicate characters is "ab", so the length is 2. Therefore, return 2.
Example 2
Input:
s = "anviaj"Output:
5For input s = "anviaj", a longest substring without duplicate characters is "nviaj", so the length is 5. Therefore, return 5.
Constraints
0 <= s.length <= 5 * 104s may contain letters, digits, symbols, and spaces.
solution.js
Loading...
Test Cases (2)
Test Case 1
Input:
"abba"Expected Output:
2Test Case 2
Input:
"anviaj"Expected Output:
5