【Leetcode】53. Maximum Subarray

求數組的最大子數組的和,經典的DP問題 方法1 DP 很容易想到遞推方程: dp[i] = dp[i-1] + nums[i] if dp[i-1]>0 else nums[i] class Solution1: def maxSubArray(self,nums): """ :type nums: List[int] :rtype: int """ dp
相關文章
相關標籤/搜索