Problem · Canonical Warm-Up
mediumsliding-window · hash-map · two-pointerTime · O(n)Space · O(min(m,n))
Longest Substring Without Repeating Characters
Problem walkthrough: statement, hints, solution, mistakes
Given a string s, find the length of the longest substring without repeating characters.
Constraints
0 ≤ s.length ≤ 5 × 104sconsists of English letters, digits, symbols and spaces.
Examples
Input: s = "abcabcbb"
Output: 3 (substring "abc")
Input: s = "bbbbb"
Output: 1 (substring "b")
Input: s = "pwwkew"
Output: 3 (substring "wke")AD SLOT · 728×90