create and build an array that stores minimum sums of subarrays that lie in arr [ i + 1. . . n - 1 ]
$ rightMin = array_fill ( 0 , $ n , NULL ) ; maxRightSubArraySum ( $ invertArr , $ n - 1 , $ rightMin ) ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ rightMin [ $ i ] = - $ rightMin [ $ i ] ; $ result = PHP_INT_MIN ; for ( $ i = 0 ; $ i < $ n - 1 ; $ i ++ ) {