Medium · Strings

Longest substring with unique characters

Given a string s, return the length of the longest substring of s (a contiguous run of characters) that contains no repeated character.

Examples

Example 1

{
  "s": "abcabcbb"
}

Output: 3

Example 2

{
  "s": "pwwkew"
}

Output: 3

Rebuild it in the studio

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Strings problems