👩💻 Join our community of thousands of amazing developers!
2489. Number of Substrings With Fixed Ratio You are given a binary string s, and two integers num1 and num2. num1 and num2 are coprime numbers. A ratio substring is a substring of s where the ratio between the number of 0’s and the number of 1’s in the substring is exactly num1 : num2. For example, if num1 = 2 and num2 = 3, then “01011” and “1110000111” are ratio substrings, while “11000” is not. Return the number of non-empty ratio substrings of s. Note that: A substring is a contiguous seq...