Tap here to switch tabs
Problem
Submissions

Problem: Ways to Split Array Into Three Subarrays

med
30 min
Try to solve the Ways to Split Array Into Three Subarrays problem.

Statement

An array of non negative integers nums is partitioned into three nonempty contiguous subarrays: left, mid, and right.

A partition is considered valid if:

  • The sum of elements in left is less than or equal to the sum of elements in mid.

  • The sum of elements in mid is less than or equal to the sum of elements in right.

Given the integer array nums, return the number of valid ways to partition nums. Since the answer may be large, return it modulo 109+710^9 + 7.

Constraints:

  • 3≤3 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Ways to Split Array Into Three Subarrays

med
30 min
Try to solve the Ways to Split Array Into Three Subarrays problem.

Statement

An array of non negative integers nums is partitioned into three nonempty contiguous subarrays: left, mid, and right.

A partition is considered valid if:

  • The sum of elements in left is less than or equal to the sum of elements in mid.

  • The sum of elements in mid is less than or equal to the sum of elements in right.

Given the integer array nums, return the number of valid ways to partition nums. Since the answer may be large, return it modulo 109+710^9 + 7.

Constraints:

  • 3≤3 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤104\leq 10^4