6
0
:0
0
Distinct Character Window
Distinct Character Window
Hard
Sliding Window
In "Distinct Character Window", given a string s, find the maximum length of a contiguous substring with all unique characters.
Example 1
Input:
s = "tmmzuxt"Output:
5For input s = "tmmzuxt", a longest substring without duplicate characters is "mzuxt", so the length is 5. Therefore, return 5.
Example 2
Input:
s = "pwwkewxyz"Output:
6For input s = "pwwkewxyz", a longest substring without duplicate characters is "kewxyz", so the length is 6. Therefore, return 6.
Constraints
0 <= s.length <= 5 * 104s may contain letters, digits, symbols, and spaces.
solution.js
Loading...
Test Cases (2)
Test Case 1
Input:
"tmmzuxt"Expected Output:
5Test Case 2
Input:
"pwwkewxyz"Expected Output:
6