code.davidloor.com
MMedium· sliding-window· hash-map· string

Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Given a string s, find the length of the longest substring that contains no repeating characters.

Example

Input: s = "abcabcbb" Output: 3 Explanation: The answer is "abc", which has length 3.

Constraints

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

Entry — lengthOfLongestSubstring

Grading — exact over 5 tests

Stuck? Browse algorithmic patterns → or read the Python / JS foundations.
Awaiting first run
Reference solution unlocks after a run & 60 s of work.