标签:code png return 局部最优 imu logs self lis for
这道题为简单题
遍历列表,找到局部最优m和全局最优n
1 class Solution(object): 2 def maxSubArray(self, nums): 3 """ 4 :type nums: List[int] 5 :rtype: int 6 """ 7 n = m = float(‘-inf‘) 8 for i in range(len(nums)): 9 m = max(nums[i], m+nums[i]) 10 n = max(n, m) 11 return n
标签:code png return 局部最优 imu logs self lis for
原文地址:http://www.cnblogs.com/liuxinzhi/p/7572127.html