Problem 3261 · Hard

Count Substrings That Satisfy K-Constraint II

Slide a window per query: a substring passes when its zeros or its ones are at most k, so the valid starts form a suffix.

Open the interactive visualisation