Longest Substring Without Repeating Characters
Given a string s, find the length of the longest substring (contiguous run of characters) that contains no repeated character.
Open official problem prompt ↗Measure the longest contiguous piece of the string in which every character is unique.
Reading a hallway of numbered doors and keeping the longest stretch you can walk without passing the same door number twice; the moment you'd repeat one, you restart just past its first occurrence.
- Input
- s = "abcabcbb"
- Output
- 3
- Why
- The longest substring with all distinct characters is "abc", which has length 3.
0 <= s.length <= 5 * 10^4s consists of English letters, digits, symbols and spaces