Longest Substring with At Most K Distinct Characters Problem

Longest Substring with At Most K Distinct Characters Problem — ExecCode Medium DSA Practice

Solve the Longest Substring with At Most K Distinct Characters problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Longest Substring with At Most K Distinct Characters. Shrink when distinct > k. For Longest Substring with At Most K Distinct Characters, focus on the exact input variables, return only the requested value, and preserve the required time complexity for the intended pattern.

Examples

Input {"s": "eceba", "k": 2}; Output 3

Constraints

1 ≤ n ≤ 10^5

Practice Longest Substring with At Most K Distinct Characters free on ExecCode. Browse DSA problems, topic map, and placement guides.