Leetcode 159. Longest Substring with At Most Two Distinct Characters
Given a string, find the length of the longest contiguous substring that contains at most two distinct characters — a sliding-window / two-pointer problem where you track character frequencies to maintain at most two active characters and achieve linear time.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Your account is free and you can post anonymously if you choose.