3788. Maximum Score of a Split
You are given an integer array
numsof lengthn.Choose an index
isuch that0 <= i < n - 1.For a chosen split index
i:
- Let
prefixSum(i)be the sum ofnums[0] + nums[1] + ... + nums[i].- Let
suffixMin(i)be the minimum value amongnums[i + 1], nums[i + 2], ..., nums[n - 1].The score of a split at index
iis defined as:
score(i) = prefixSum(i) - suffixMin(i)Return an integer denoting the maximum score over all valid split indices.
1 | class Solution { |