leetle

Daily challenge for 2025-06-12

163. Longest Substring with At Most K Distinct Characters

Write a function solve that finds the length of the longest substring that contains at most k distinct characters.

Example:
Input: s = "eceba", k = 2
Output: 3 (substring "ece")

Run this challenge interactively in Python or JavaScript when the app loads.