Intermediate
Open
Pro
Longest Substring With Unique Characters
Given a string s, find the length of the longest substring that
does not contain any repeated characters.
Example 1:
Input: s = "abcabcbb"
Output: 3
Explanation: The longest substring without repeating characters is
"abc", which has length 3.
Example 2:
Input: s = "bbbbb"
Output: 1
Explanation: The longest substring without repeating characters is
"b", with length 1.
Example 3:
Input: s = "pwwkew"
Output: 3
Explanation: The longest substring without repeating characters is
"wke", with length 3. Note that "pwke" is a subsequence, not a
substring, so it does not count.
Constraints:
0 <= s.length <= 5 * 10^4sconsists of English letters, digits, symbols, and spaces.
Share this question