Skip to content

Instantly share code, notes, and snippets.

@whaleee
Created December 4, 2014 20:02
Show Gist options
  • Save whaleee/80ace5ad633f17e035f2 to your computer and use it in GitHub Desktop.
Save whaleee/80ace5ad633f17e035f2 to your computer and use it in GitHub Desktop.
class Solution:
# @param A, a list of integers
# @return an integer
def maxSubArray(self, A):
ThisSum = 0
MaxSum = -10000
for i in range(0, len(A)):
if ThisSum < 0:
ThisSum = 0
ThisSum = ThisSum + A[i]
MaxSum = max(ThisSum, MaxSum)
return MaxSum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment