Longest Substring Without Repeating Characters

Given a string `s`, find the **length** of the longest substring without repeating characters. Use a sliding window over the string and a hash/set to track unique characters.

Input Format

s = input string

Output Format

integer (length of longest substring without repeating characters)

Constraints

  • 0 <= s.length() <= 10^5; s consists of ASCII characters.

Examples

Example 1:

Input:

s = "geeksforgeeks"

Output:

7

Example 2:

Input:

s = "bbbbb"

Output:

1
Loading...
Longest Substring Without Repeating Characters