Given an integer array nums, find the subarray with the largest sum and return that sum.
A subarray is a contiguous non-empty sequence.
Input: An integer array nums of length n.
Output: Integer — maximum subarray sum.
Input: [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explanation: Subarray [4,-1,2,1] has sum 6. This is the maximum.Input: [1]
Output: 1
Explanation: Only one element. Return it.Input: [5,4,-1,7,8]
Output: 23
Explanation: Entire array sums to 23.1 <= nums.length <= 10^5-10^4 <= nums[i] <= 10^4