Algorithm For Maximum Subarray Value