FunctionRacerProblemsRace

Longest Substring Without Repeating Characters

MediumTwo pointersPython, JavaScript, TypeScript, Java, C++

Return the length of the longest contiguous piece of s in which no character appears twice. An empty string gives 0.

Example 1

s "abcabcbb"
returns 3

The piece abc has length 3.

Example 2

s "bbbb"
returns 1

Only a single b fits.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Two pointers problems