Python beats 90%


  • 0
    E

    class Solution(object):

    def maxSubArray(self, nums):
    	sum_local,sum_global = nums[0],nums[0]
    	for num in nums[1:]:
    		sum_local = max(sum_local + num,num)
    		sum_global = max(sum_local,sum_global)
    	return sum_global

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.