Facebook Pixel

You are on level: Student

0%
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section
Expand section

Longest Substring without Repeating Characters

Find the length of the longest substring of a given string without repeating characters.

Input: abccabcabcc

Output: 3

Explanation: The longest substrings are abc and cab, both of length 3.

Use the "Sample 1: abccabcabcc" preset in the visualizer below to replay this case.

Input: aaaabaaa

Output: 2

Explanation: ab is the longest substring, with a length of 2.

Use the "Sample 2: aaaabaaa" preset in the visualizer below to replay this case.

Try it yourself

Invest in Yourself
Your new job is waiting. 83% of people that complete the program get a job offer. Unlock unlimited access to all content and features.
Go Pro