Maximum subarray

description

class Solution(object):
    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        maxArray = nums[0]
        currArray = 0

        for n in nums:
            if currArray < 0:
                currArray = 0
            currArray += n
            maxArray = max(maxArray, currArray)
        return maxArray