Longest Distinct Window
Return the length of the longest substring of s in which no character repeats.
Requirements
- Run in time.
Examples
EXAMPLE WALKTHROUGHrepeating pattern
A guided view of the published example, not a trace of your code.
INPUT
["abcabcbb"]TASKlongest_distinct_window()
EXPECTED OUTPUT
3Start with the input values shown in this example.
Example 1 of 3
Input: s = "abcabcbb"
Output: 3
Explanation: repeating pattern
Input: s = "bbbbb"
Output: 1
Explanation: one character
Input: s = "pwwkew"
Output: 3
Explanation: window in the middle
Hint 1
Grow a window to the right; when a character repeats, move the left edge just past its previous position.