Hard35 min
Maximum Subarray Sum
Return the largest sum of a contiguous, nonempty section of the input array.
Your function
Implement solve(value, extra) in JavaScript. Return the answer; printing alone does not count as a result.
Examples
Input:
[[-2,1,-3,4,-1,2,1,-5,4]]Output:
6Input:
[[-3,-1,-2]]Output:
-1Constraints
Input contains at most 1,000 values or characters. Numbers are finite integers. Inputs follow the structure shown in the examples.