Longest substring without repeats
Mediumstringsliding windowhash map
Return the length of the longest contiguous part of s with no repeated character.
Example 1
Input: s = "abcabcbb" Output: 3
abc.
Example 2
Input: s = "bbbbb" Output: 1
Example 3
Input: s = "pwwkew" Output: 3
wke. pwke isn't contiguous.
Constraints
- 0 ≤ s.length ≤ 5·10⁴
- Letters, digits, symbols and spaces
Submit checks your solution against 9 tests, including hidden ones.
/**
* @param {string} s
* @return {int}
*/
function lengthOfLongestSubstring(s) {
}