Implemented Kadane's algorithm for computing the maximum subarray