📘
Longest Substring Without Repeating Characters
MediumSliding Window
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
abcabcbband looking for substrings without repeating characters - The longest such substrings are
abc,bcb, andcab, each having a length of 3 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 3, 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
Editor
Python 3.13.1
Test Results
0/0Run code to see test results.