dsa · medium

Longest Substring Without Repeating Characters

GreyOrangeStringSliding Window

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

Arguments

**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

Open in the Dojo editor