This question evaluates a candidate's skills in string manipulation, algorithm design, and reasoning about time and space complexity when identifying maximal contiguous substrings with distinct characters.
Given a string s, return the length of the longest contiguous substring that contains no repeated characters.
s
: a string (may contain letters, digits, symbols, and spaces).
s
with all distinct characters.
"abcabcbb"
→ Output:
3
(e.g.,
"abc"
)
"bbbbb"
→ Output:
1
(e.g.,
"b"
)
"pwwkew"
→ Output:
3
(e.g.,
"wke"
)
0 <= len(s) <= 2 * 10^5