A session is a string of page codes (characters). Return the length of the longest contiguous stretch with no repeated character.
Signature
longestUnique(s: string) → intExample 1
s = "abcabcbb"
output = 3
'abc' → 3
Example 2
s = "pwwkew"
output = 3
'wke' → 3
Example 3
s = ""
output = 0
Constraints
0 ≤ |s| ≤ 5·10^4
⌘/Ctrl + Enter runs examples
Run checks the examples. Submit runs every hidden test (18, including large inputs that catch slow solutions).