Given a string s, return the length of the longest substring (a run of consecutive characters) in which all characters are different.
The starter code restarts from every position and grows until it hits a repeat. Make it fast.
Example 1
Input:
longest_unique_substring('abcabcbb')
Output:
3
The longest is abc.
Example 2
Input:
longest_unique_substring('bbbbb')
Output:
1
The longest is b.
Example 3
Input:
longest_unique_substring('pwwkew')
Output:
3
The longest is wke.
0 <= len(s) <= 2 * 10**5s can contain any characters.No results yet
Run your code to check it against the examples, or submit to run every test.