1.3 Longest Substring with K Distinct Characters (medium)
Problem Statement
Input: String="araaci", K=2
Output: 4
Explanation: The longest substring with no more
than '2' distinct characters is "araa".Input: String="araaci", K=1
Output: 2
Explanation: The longest substring with no more
than '1' distinct characters is "aa".Input: String="cbbebi", K=3
Output: 5
Explanation: The longest substrings with no more
than '3' distinct characters are "cbbeb" & "bbebi".Solution
Time Complexity
Space Complexity
Last updated