Practice Ways to Split Array Into Good Subarrays
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
You are given a binary array nums. A subarray of an array is good if it contains exactly one element with the value 1. Return an integer denoting the number of ways to split the array nums into good subarrays. As the number may be too large, return it modulo 10^9 + 7. A subarray is a contiguous non-empty sequence of elements within an array.
Source: Ways to Split Array Into Good Subarrays on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [0,1,0,0,1]
3
# Example 2
nums = [0,1,0]
1
Constraints
Related LeetCode Problems
Practice more problems similar to Ways to Split Array Into Good Subarrays.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.