Longest Substring Without Repeating Characters

Problem Find the length of the longest substring of s with no repeated characters.

Input / Output

  • Input: string s.
  • Output: max length.

Constraints

  • |s| up to 5*10^4; O(n) expected.

Example

  • "abcabcbb" → 3 ("abc"); "bbbbb" → 1; "pwwkew" → 3 ("wke" — substring, not subsequence).
asked …
LeaderboardSalaryAccount