Algorithm For Maximum Subarray Problem