Skip to content
6
0
:
0
0

Unique Chat Window

Medium

Sliding Window

In "Unique Chat Window", given a string s, find the maximum length of a contiguous substring with all unique characters.

Example 1

Input:s = "abcdeafgh"
Output:8

For 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:3

For input s = "dvdf", a longest substring without duplicate characters is "vdf", so the length is 3. Therefore, return 3.

Constraints

  • 0 <= s.length <= 5 * 104
  • s may contain letters, digits, symbols, and spaces.
solution.js
Loading...

Test Cases (2)

Test Case 1
Input:
"abcdeafgh"
Expected Output:
8
Test Case 2
Input:
"dvdf"
Expected Output:
3