Longest Substring Without Repeating Characters
Medium
Strings
Sliding Window
Hash Set
Given a string `s`, find the length of the longest substring without repeating characters.
Constraints
0 <= s.length <= 50000
s consists of English letters, digits, symbols and spaces.
Examples
Example 1:
Input: abcabcbb
Output:
Explanation: abc is the longest
Example 2:
Input: bbbbb
Output:
Hints
Use a sliding window approach.
Keep track of characters in the current window.
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console