Tap here to switch tabs
Problem
Submissions

Problem: Split Array With Minimum Difference

Try to solve the Split Array With Minimum Difference problem.

Statement

You are given an integer array nums.

A split at index i (where 0≤i<0 \leq i < nums.length −1- 1) divides the array into two parts:

  • left consisting of elements from index 00 to i

  • right consisting of elements from index i + 1 to nums.length −1- 1

A split is considered valid if:

  • left is strictly increasing

  • right is strictly decreasing

Return the minimum absolute difference between the sum of elements in left and the sum of elements in right among all valid splits. If no valid split exists, return −1-1.

Constraints:

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

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Split Array With Minimum Difference

Try to solve the Split Array With Minimum Difference problem.

Statement

You are given an integer array nums.

A split at index i (where 0≤i<0 \leq i < nums.length −1- 1) divides the array into two parts:

  • left consisting of elements from index 00 to i

  • right consisting of elements from index i + 1 to nums.length −1- 1

A split is considered valid if:

  • left is strictly increasing

  • right is strictly decreasing

Return the minimum absolute difference between the sum of elements in left and the sum of elements in right among all valid splits. If no valid split exists, return −1-1.

Constraints:

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

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