Given an integer array, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
nums = array of integers
Maximum sum of a contiguous subarray
Example 1:
Input:
nums = [-2,1,-3,4,-1,2,1,-5,4]
Output:
6
Explanation:
Subarray [4,-1,2,1] has sum 6.