Assumptions
There are no empty subarrays within the input array.
globalMaxSum denotes the largest sum of a contiguous subarray in an input array.
- localMaxSum at index i denotes the largest sum of the subarrays starting with the element at input[i].
- n is the size of the input array.