Example 1
Input
s = "abcabcbb"
Output
3
Loading CodeSprint...
/problems/longest-unique-substring
Return the length of the longest contiguous part of a string that contains no repeated character.
Implement this function and return the result. CodeSprint supplies each test case automatically.
lengthOfLongestSubstring(s) → numberInput
s = "abcabcbb"
Output
3
Input
s = "bbbbb"
Output
1
Constraints
0 <= s.length <= 100,000 s may contain letters, digits, spaces, and punctuation.