Category: two pointer

Longest Substring with At Most K Distinct Characters

Given a string s, find the length of the longest substring T that contains at most k distinct characters.

For example, Given s = "eceba"k = 3,

T is "eceb" which its length is 4.
solution

Advertisements