Practice/Meta/Leetcode 3. Longest Substring Without Repeating Characters
CodingMust
Given a string, determine the length of the longest contiguous substring that contains all unique characters (no character appears more than once within that substring).
You need to find the maximum length among all possible substrings where every character appears at most once.
Example 1:
Input: s = "abcabcbb" Output: 3 Explanation: The longest substring without repeating characters is "abc", which has length 3.
Example 2:
Input: s = "bbbbb" Output: 1 Explanation: The longest substring is "b", with length 1.
Example 3:
Input: s = "pwwkew" Output: 3 Explanation: The longest substring is "wke", with length 3. Note that "pwke" is not valid because it's not a substring (the characters aren't consecutive).
Example 4:
Input: s = "" Output: 0 Explanation: An empty string has no characters.