Problem 3258 · Easy

Count Substrings That Satisfy K-Constraint I

Slide a window that never holds more than k zeros or more than k ones, and count the valid ends for each right edge.

Open the interactive visualisation