zeros zeros and ones ones. A string qualifies if it has no run of equal characters longer than max_run, that is, no max_run + 1 consecutive characters are all the same.
Count the qualifying strings. The answer can be large, so return it modulo 10⁹ + 7.zeros=2, ones=1, max_run=1 → 1
Only 010 works: 001 and 100 put two zeros side by side.
zeros=2, ones=2, max_run=2 → 6
No run can exceed 2 here anyway, so all C(4, 2) = 6 arrangements count.
zeros=3, ones=2, max_run=2 → 7
Out of 10 arrangements, drop those with three zeros in a row: 00011, 10001, 11000. That leaves 7.
zeros, ones, max_run ≤ 200zeros=2, ones=1, max_run=1
1
Run checks the first 3 tests in your browser. Submit checks all 131 tests on the server, hidden ones included.