Practice Find All Possible Stable Binary Arrays II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given zero, one, and limit, count binary arrays containing exactly zero zeroes and one ones in which every contiguous subarray longer than limit contains both digits. Equivalently, no run of equal digits may exceed limit. Return the count modulo 10^9 + 7.
Source: Find All Possible Stable Binary Arrays II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
zero = 1, one = 1, limit = 2
Output
2
# Example 2
Input
zero = 1, one = 2, limit = 1
Output
1
# Example 3
Input
zero = 3, one = 3, limit = 2
Output
14
Constraints
1 <= zero, one, limit <= 1000
Related LeetCode Problems
Practice more problems similar to Find All Possible Stable Binary Arrays II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.