Maximum Subarray Problem Algorithm