Practice Ways to Split Array Into Three Subarrays
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Medium#1712
LeetCode ProblemWays to Split Array Into Three Subarrays
Problem Statement
Split nonnegative nums into exactly three nonempty contiguous pieces, in order left, mid, right. Count splits satisfying sum(left) <= sum(mid) <= sum(right), and return the count modulo 10^9 + 7.
Source: Ways to Split Array Into Three Subarrays on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [1,1,1]
Output
1
# Example 2
Input
nums = [1,2,2,2,5,0]
Output
3
# Example 3
Input
nums = [3,2,1]
Output
0
Constraints
3 <= nums.length <= 10^5
0 <= nums[i] <= 10^4
Related LeetCode Problems
Practice more problems similar to Ways to Split Array Into Three Subarrays.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.