Longest Non-Repeating Substring Length
Problem Statement
Given a string, determine the length of the longest substring that contains no repeating characters.
Examples
Example 1:
Input: "abcaabcd" Output: 4 Explanation: The longest substring without repeating characters is "abca" or "abcd", both with length 4.
Example 2:
Input: "lllll" Output: 1 Explanation: The longest non-repeating substring is "l" with length 1.
Example 3:
Input: "xyzzyx" Output: 3 Explanation: The longest substring without repeating characters is "xyz" with length 3. Note that "xyzz" is not valid as it contains repeating 'z's.
Constraints
- 1 ≤ length of the string ≤ 5 × 104
- The string consists of English letters, digits, symbols, and spaces.