Problem 2489 · Medium

Number of Substrings With Fixed Ratio

Turn each prefix of a binary string into one running key; two equal keys mark a substring with the requested zeros-to-ones ratio.

Open the interactive visualisation