Algorithms Playbook
← All problems
MediumSliding window →Similar to: Longest Substring Without Repeating Characters

The longest run without repeats

Problem

Given a string s, return the length of the longest substring in which every character is different.

Examples

Input: "abcabcbb"

Output: 3

"abc" is the longest without repeats.

Input: "pwwkew"

Output: 3

Hints

    Try it first. Every hint reveals a bit more.

    Solution