v9.1.1
Menu

Longest Substring Without Repeating Characters

mediumFREESliding WindowBlind 75

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

Example

Input
abcabcbb
Output
3
Reasoning
  • We start by examining the input string abcabcbb and looking for substrings without repeating characters
  • The longest such substrings are abc, bcb, and cab, each having a length of 33 characters
  • We can see that there are no longer substrings without repeating characters, as any additional character would result in a repeated character
  • The final output is therefore 33, which is the length of the longest substring without repeating characters

Constraints

  • 0 <= len(s) <= 5 * 10^4
  • s consists of English letters, digits, symbols and spaces

Learn this in

More from Blind 75

solution.py

Test results

Sign in to run your code against the test cases.