https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters/ Longest Substring with At Most Two Distinct Characters Total Accepted: 4982 Total Submissions: 16108 Difficulty: Hard Given a string, find the length of the longest substring T that contains at most 2 distinct characters. For example, Given s = “eceba”, T is “ece” which its length is 3. Code class Solution(object): def lengthOfLongestSubstringTwoDistinct(self, s): …
Continue reading “Leetcode 159: Longest Substring with At Most Two Distinct Characters”