Created
December 4, 2014 20:02
-
-
Save whaleee/80ace5ad633f17e035f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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