Longest Substring Without Repeating Characters

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

Input Format

s = "input string"

Output Format

integer (length of longest unique-character substring)

Constraints

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

Examples

Example 1:

Input:

s = "abcabcbb"

Output:

3

Explanation:

The longest substring without repeating letters is "abc" of length 3.

Example 2:

Input:

s = "bbbbb"

Output:

1

Explanation:

Longest unique substring is "b" of length 1.

Loading...
Longest Substring Without Repeating Characters