__author__ = 'yibeihuang'


class Solution(object):

    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        max_sofar = max_now = nums[0]
        for i in range(1, len(nums)):
            max_now = max(nums[i], max_now + nums[i])
            max_sofar = max(max_sofar, max_now)
        return max_sofar

ed46ee6c01943b269c1cfa697a7699b034bbc505
<mask token>

<mask token>


class Solution(object):
    <mask token>

<mask token>


class Solution(object):

    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        max_sofar = max_now = nums[0]
        for i in range(1, len(nums)):
            max_now = max(nums[i], max_now + nums[i])
            max_sofar = max(max_sofar, max_now)
        return max_sofar

__author__ = 'yibeihuang'


class Solution(object):

    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        max_sofar = max_now = nums[0]
        for i in range(1, len(nums)):
            max_now = max(nums[i], max_now + nums[i])
            max_sofar = max(max_sofar, max_now)
        return max_sofar
