Longest Substring Without Repeating Characters
Given a string s, find the length of the longest substring without repeating characters.
A substring is a contiguous sequence of characters within a string. Return the maximum possible length among all substrings of s that contain no duplicate characters.
Example 1
Input
s = "abcabcbb"Output
3The longest substrings without repeating characters are
abc, bca, cab, and abc, each with length 3.Example 2
Input
s = "pwwkew"Output
3The longest substring without repeating characters is
wke, which has length 3.Constraints
- 0 <= s.length <= 5 * 10^4
- s consists of English letters, digits, symbols, and spaces.