dsa · medium
Longest Substring Without Repeating Characters
GreyOrangeStringSliding Window
Given a string s, find the length of the longest substring without repeating characters.
Arguments
s— the input string (or list of characters, if reversing in place)
**Example 1:** `` Input: s = "abcabcbb" Output: 3 ` **Example 2:** ` Input: s = "bbbbb" Output: 1 ``
Constraints
0 <= s.length <= 5 * 10^4 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.
Examples
Example 1
Input: abcabcbb Expected: 3
Example 2
Input: bbbbb Expected: 1