Longest Substring Without Repeating Characters


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Problem type
Allowed languages
C++, Python

Problem Description

Given a string s, find the length of the longest substring without repeating characters.

Examples

Example 1:
Input: s = "abcabcbb"
Output: 3
Explanation: The longest substring without repeating characters is "abc", with length 3. "bca" and "cab" are also valid.

Example 2:
Input: s = "bbbbb"
Output: 1
Explanation: The longest substring is "b", with length 1.

Example 3:
Input: s = "pwwkew"
Output: 3
Explanation: The longest substring is "wke", with length 3.
Note that "pwke" is a subsequence, not a substring.

Constraints

  • 0 <= s.length <= 5 × 104
  • s consists of English letters, digits, symbols, and spaces.

Comments

There are no comments at the moment.