filmov
tv
Java hands On Exploring Distinct Characters Finding the Longest Substring
![preview_player](https://i.ytimg.com/vi/YgV2t-js7SU/maxresdefault.jpg)
Показать описание
Hello everyone! Welcome back to the Java Hands-On series
You are given a string s containing only lowercase letters. Your task is to find the length of the longest substring that contains at most k distinct characters.
Example: Input: s = "abacacacbb" k = 2
Output: The longest substring with at most 2 distinct characters is "aca", with a length of 3.
You are given a string s containing only lowercase letters. Your task is to find the length of the longest substring that contains at most k distinct characters.
Example: Input: s = "abacacacbb" k = 2
Output: The longest substring with at most 2 distinct characters is "aca", with a length of 3.