Tap here to switch tabs
Problem
Submissions

Problem: Number of Ways to Split Array

Number of Ways to Split Array asks you to count split indices where the nonempty left portion's sum is at least the nonempty right portion's sum, including arrays with negative values.

Statement

Given an integer array nums, choose an index i to split nums into two non empty parts: the left part nums[0..i] and the right part nums[i+1..n-1], where n is the length of nums.

A split at index i is considered valid if the sum of the left part is greater than or equal to the sum of the right part. Return the total number of valid split indices i.

Constraints:

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

  • −105≤-10^5 \leq nums[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Ways to Split Array

Number of Ways to Split Array asks you to count split indices where the nonempty left portion's sum is at least the nonempty right portion's sum, including arrays with negative values.

Statement

Given an integer array nums, choose an index i to split nums into two non empty parts: the left part nums[0..i] and the right part nums[i+1..n-1], where n is the length of nums.

A split at index i is considered valid if the sum of the left part is greater than or equal to the sum of the right part. Return the total number of valid split indices i.

Constraints:

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

  • −105≤-10^5 \leq nums[i] ≤105\leq 10^5