Search
⌘K
Get Premium
Leetcode 2489. Number of Substrings With Fixed Ratio
Count how many substrings of a (typically binary) string have the counts of two characters in a given fixed ratio p:q. The core challenge is to map running character-counts to a canonical (normalized) form so you can aggregate occurrences and count all valid substrings efficiently rather than checking every substring.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.