Skip to content
6
0
:
0
0

No-Duplicate Signal Span: Packet Stream Edition

Easy

Sliding Window

In "No-Duplicate Signal Span: Packet Stream Edition", given a string s, find the maximum length of a contiguous substring with all unique characters.

Example 1

Input:s = "tmmzuxt"
Output:5

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

For input s = "pwwkewxyz", a longest substring without duplicate characters is "kewxyz", so the length is 6. Therefore, return 6.

Constraints

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

Test Cases (2)

Test Case 1
Input:
"tmmzuxt"
Expected Output:
5
Test Case 2
Input:
"pwwkewxyz"
Expected Output:
6