54. Longest Substring Without Repeating Characters
Medium
Given a string texto, return the length of the longest contiguous substring that contains no repeated characters. Characters are compared exactly as they appear.
Example 1
Input: texto = "abcaef"
Output: 5
Explanation: "bcaef" is a five-character substring with no repeats.
Example 2
Input: texto = "aaaa"
Output: 1
Constraints
- 0 <= texto.length <= 10^5
- texto contains ASCII characters.
StringsHash mapSliding window
Saved in this browser
Caso 1
texto =
"abcaef"
Expected =
5
Caso 2
texto =
"aaaa"
Expected =
1
Run checks these 2 cases. Submit runs all 6, including hidden ones.