Ways to Split Array Into Three Subarrays
A split of an integer array is good if: Given nums, an array of non-negative integers, return the number of good ways to split nums.
A split of an integer array is good if:
Given nums, an array of non-negative integers, return the number of good ways to split nums. As the number may be too large, return it modulo 10^9 + 7.
Example 1
Input: nums = [1,1,1]
Output: 1
Explanation: The only good way to split nums is [1] [1] [1].
Example 2
Input: nums = [1,2,2,2,5,0]
Output: 3
Explanation: There are three good ways of splitting nums: [1] [2] [2,2,5,0] [1] [2,2] [2,5,0] [1,2] [2,2] [5,0]
Example 3
Input: nums = [3,2,1]
Output: 0
Explanation: There is no good way to split nums.
Constraints
- 3 <= nums.length <= 10^5
- 0 <= nums[i] <= 10^4
Hints
Companies
No companies reported yet.
Discussion
Sign in to join the discussion.
Loading discussion...
Test results
No test cases yet.