Skip to content

Instantly share code, notes, and snippets.

@rohit-jamuar
Created October 17, 2013 00:33
Show Gist options
  • Save rohit-jamuar/7017392 to your computer and use it in GitHub Desktop.
Save rohit-jamuar/7017392 to your computer and use it in GitHub Desktop.
def foo(arr):
from sys import maxint
currentSum,maxSum=0,-maxint-1
for i in arr:
currentSum+=i
if currentSum<0:
currentSum=0
elif currentSum>maxSum:
maxSum=currentSum
return maxSum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment