3130. Find All Possible Stable Binary Arrays II
You are given 3 positive integers
zero
,one
, andlimit
.A binary array
arr
is called stable if:
- The number of occurrences of 0 in
arr
is exactlyzero
.- The number of occurrences of 1 in
arr
is exactlyone
.- Each subarray of
arr
with a size greater thanlimit
must contain both 0 and 1.Return the total number of stable binary arrays.
Since the answer may be very large, return it modulo
109 + 7
.
c++
1 |
|