This algorithm is used to compute the largest contiguous subarray sum.
Consider the following example:
a = {-2, -3, 4, -1, -2, 1, 5, -3}
Largest contiguous subarray sum is 7 and the required subarray is {4, -1, -2, 1, 5}
O(n) where n is length of the array
O(1) which means constant space