Sliding windowmedium
Longest run without repeats
Given a string s, return the length of the longest contiguous substring in which no character appears twice.
Aim for one pass over s.
Besides the tests, one large input (a 6,000-character string) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
longest_unique("abcabcbb")→3longest_unique("bbbbb")→1longest_unique("pwwkew")→3