Company: Visa (Associate SW Engineer) off campus_17march
Difficulty: medium
A binary string consists only of the digits 0 and 1. A binary string is considered "good" if: The digit 1 only appears in groups of size one_group , if it appears at all The digit 0 only appears in groups of size zero_group , if it appears at all For example, with one_group = 2 and zero_group = 1, the strings "011" and "000" are good, while "001" and "111" are not Given four integers min_length , max_length , one_group , and zero_group , find the number of good binary strings with lengths in the range [ min_length , max_length ]. Return the answer modulo (10 9 + 7). Example min_length = 1 max_length = 3 one_group = 2 zero_group = 1 The good strings are: ["0", "00", "11", "011", "110", "000"] The answer is 6. Function Description Complete the function countGoodStrings in the editor with the following parameters: min_length : the minimum length of a good string max_length : the maximum length of a good string one_group : the group size of ones zero_group : the group size of zeros Returns