End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
currentSubarray and maxSubarray, to the first element of the array.currentSubarray. If currentSubarray becomes negative, reset it to zero.maxSubarray with the maximum of maxSubarray and currentSubarray.maxSubarray as the result.