For the best coding experience, use a desktop browser.
Medium
Sliding Window

Longest Substring Without Repeating Characters

Given a string `s`, find the length of the **longest substring** without repeating characters.

Constraints

- 0 <= s.length <= 5 * 10^4
- s consists of English letters, digits, symbols and spaces.

Examples

Input: s = "abcabcbb"
Output: 3
The answer is "abc", with the length of 3.
Input: s = "bbbbb"
Output: 1
The answer is "b", with the length of 1.

Sample Test Cases

Case 1 Input: "abcabcbb"
Expected: 3
Case 2 Input: "bbbbb"
Expected: 1