Tap here to switch tabs
Problem
Submissions

Problem: Find All Possible Stable Binary Arrays II

med
30 min
Try to solve the Find All Possible Stable Binary Arrays II problem.

Statement

Given three positive integers zero, one, and limit.

A binary array arr is considered stable if:

  • The number of occurrences of 00 in arr is exactly zero.

  • The number of occurrences of 11 in arr is exactly one.

  • Every contiguous subarray of arr with a length strictly greater than limit contains at least one 00 and at least one 11.

Return the total number of stable binary arrays. Since the answer can be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq zero, one, limit ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find All Possible Stable Binary Arrays II

med
30 min
Try to solve the Find All Possible Stable Binary Arrays II problem.

Statement

Given three positive integers zero, one, and limit.

A binary array arr is considered stable if:

  • The number of occurrences of 00 in arr is exactly zero.

  • The number of occurrences of 11 in arr is exactly one.

  • Every contiguous subarray of arr with a length strictly greater than limit contains at least one 00 and at least one 11.

Return the total number of stable binary arrays. Since the answer can be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq zero, one, limit ≤1000\leq 1000