Tap here to switch tabs
Problem
Submissions

Problem: Maximum Score of a Split

Try to solve the Maximum Score of a Split problem.

Statement

You are given an integer array nums of size nn.

A split is defined by choosing an index i such that 0≤i<n−10 \leq i < n - 1, which partitions the array into two contiguous segments:

  • A prefix consisting of elements from index 00 to index i inclusive.

  • A suffix consisting of elements from index i+1i + 1 to index n−1n - 1 inclusive.

The score of a split at index i is calculated as the sum of the elements in the prefix minus the minimum element in the suffix:

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Score of a Split

Try to solve the Maximum Score of a Split problem.

Statement

You are given an integer array nums of size nn.

A split is defined by choosing an index i such that 0≤i<n−10 \leq i < n - 1, which partitions the array into two contiguous segments:

  • A prefix consisting of elements from index 00 to index i inclusive.

  • A suffix consisting of elements from index i+1i + 1 to index n−1n - 1 inclusive.

The score of a split at index i is calculated as the sum of the elements in the prefix minus the minimum element in the suffix: