Given an array A
of n
real numbers, are the maximum prefix sum and minimum suffix sum (and vice-versa) of A complements?
I.e. Given A[1..n]
and its maximum prefix subarray P[1..i]
, is its minimum suffix subarray S[j..n]
where i+1 = j
?
Or stated another way, is sum(A) = maxPrefixSum(A) + minSuffixSum(A)
true?
For an array of only negative numbers, let's assume that P
is empty and maxPrefixSum(A) = 0
. Similar logic applies in the opposite case.