maxSubArray = function(nums, maxSum = -Infinity) {
    for (let i = 0, sum = 0; i < nums.length; i++) {
        for (let j = i; j < nums.length; j++) {
            sum += nums[j];
            maxSum = Math.max(maxSum, sum);
        }
    }

    return maxSum;
}
https://leetcode.com/problems/maximum-subarray/
Time O(N^2) | Space O(1)
@param {number[]} nums
@return {number}