0159. Longest Substring with At Most Two Distinct Characters
https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters
Description
Given a string s
, return the length of the longest substring that contains at most two distinct characters.
Example 1:
Example 2:
Constraints:
1 <= s.length <= 105
s
consists of English letters.
ac: sliding window
same as this one: https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/description/
Previous0158. Read N Characters Given Read4 II - Call multiple timesNext0160. Intersection of Two Linked Lists
Last updated