3. Longest Substring Without Repeating Characters

Practice Longest Substring Without Repeating Characters for free on NudgeCode: Medium, Sliding Window pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Find the length of the longest contiguous piece of s in which no character appears twice.

Example

s = "abcabcbb"  ->  3   ("abc")
s = "bbbbb"     ->  1   ("b")
s = "pwwkew"    ->  3   ("wke"; "pwke" is not contiguous)

Constraints