Given an integer array, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. This is the classic Kadane's Algorithm problem.
Given an integer array, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. This is the classic Kadane's Algorithm problem.
Example
Input: [-2,1,-3,4,-1,2,1,-5,4]
Output: 6