- Find the maximum sum of a contiguous subarray in a given array. - Add the current element to sum. - Update maxi if the current sum is greater than maxi. - If sum becomes negative, reset sum to 0.
/* The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an array or list of integers: * maxSequence({-2, 1, -3, 4, -1, 2, 1, -5, 4}, 9) => should return ...