Find the contiguous subarray with the largest sum.
Example: [-2,,-3,,-1,,,-5,4]. Answer: (subarray [4,-1,,1]).
This is classic and has a beautiful greedy solution: Kadane's algorithm. Constraint: . Checking all time using space subarrays times out. Kadane gives .