159. Longest Substring with At Most Two Distinct Characters
Description
Given a string s , find the length of the longest substring t that contains at most 2 distinct characters.
Constraints
Approach
Links
YouTube
Examples
Input: "eceba"
Output: 3
Explanation: t is "ece" which its length is 3.
Input: "ccaabbb"
Output: 5
Explanation: t is "aabbb" which its length is 5.
Solutions
Follow up
Previous158. Read N Characters Given Read4 II - Call multiple timesNext160. Intersection of Two Linked Lists
Last updated
Was this helpful?