Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

def maxSubArray(self, nums): T = nums[0] maxsub = T for i in nums[1:]: T += i if i > T: T = i if T > maxsub: maxsub = T return maxsub

We have the same solution idea! :)

def maxSubArray(self, nums): maxn=nums[0] i=1 max1=maxn while i<len(nums): if maxn+nums[i]<nums[i]: maxn=nums[i] else: maxn=maxn+nums[i] i=i+1 if max1<maxn: max1=maxn return max1

i > T is pretty intuitive @

This is by far the best solution so far. I came to the same solution as well!

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