class Solution:

    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype
        """
        sum = max_sum = nums[0]
        for n in nums[1:]:
            sum = max(sum + n, n)
            max_sum = max(sum, max_sum)
        return max_sum


test1 = [-2, 1, -3, 4, -1, 2, 1, -5, 4]
s = Solution()
print(s.maxSubArray(test1))

50e4b1a9b5a409a74a39a883611c84a35dd7ef56
class Solution:
    <mask token>


<mask token>

class Solution:

    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype
        """
        sum = max_sum = nums[0]
        for n in nums[1:]:
            sum = max(sum + n, n)
            max_sum = max(sum, max_sum)
        return max_sum


<mask token>

class Solution:

    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype
        """
        sum = max_sum = nums[0]
        for n in nums[1:]:
            sum = max(sum + n, n)
            max_sum = max(sum, max_sum)
        return max_sum


<mask token>
print(s.maxSubArray(test1))

class Solution:

    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype
        """
        sum = max_sum = nums[0]
        for n in nums[1:]:
            sum = max(sum + n, n)
            max_sum = max(sum, max_sum)
        return max_sum


test1 = [-2, 1, -3, 4, -1, 2, 1, -5, 4]
s = Solution()
print(s.maxSubArray(test1))
