def maxSubArray(self, nums: List[int]) -> int:
# initialize maximum subarray as the maximum in the list
max_subarray, curr = max(nums), 0
# interate over values of the list from left to right
for x in nums:
curr += x # add the value to the current running sum
max_subarray = max(max_subarray, curr) # if the new running sum is greater then store is as the max
curr = max(0, curr) # if the running sum is smaller than 0 reinitialize it to 0
return(max_subarray)