Problem 3329 · Medium

Count Substrings With K-Frequency Characters II

Count the substrings where every letter stays below k with a sliding window, then subtract that count from all substrings.

Open the interactive visualisation