【Leetcode】【Python】53Maximum Subarray

问题描述: 求解最大连续子串

【Leetcode】【Python】53Maximum Subarray_第1张图片
Paste_Image.png

代码示例:动态规划

class Solution(object):
    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        for i in range(1,len(nums)):
            nums[i] = max(nums[i-1]+nums[i],nums[i])
        return max(nums)

你可能感兴趣的:(【Leetcode】【Python】53Maximum Subarray)