Jul 27, 2024
Example 1:
Example 2:
substring_count(s: str, K: int) -> intexactly K = at least K - at least (K + 1)L (start index) and R (end index) to find substrings.R to find the first index where the number of distinct characters >= K.L with this count.def substring_count(s: str, K: int) -> int:
return count_substrings_at_least_k(s, K) - count_substrings_at_least_k(s, K + 1)