Skip to content

Instantly share code, notes, and snippets.

@brandonlee503
Created October 3, 2015 21:25
Show Gist options
  • Save brandonlee503/1cd669d320fa3e5d8c22 to your computer and use it in GitHub Desktop.
Save brandonlee503/1cd669d320fa3e5d8c22 to your computer and use it in GitHub Desktop.
CS 325 Algorithms HW 1 Problem 3
def func3(arr):
maxSum = 0
currentSum = 0
for i in arr:
if currentSum + i > 0:
currentSum = currentSum + i
else:
currentSum = 0
if currentSum > maxSum:
maxSum = currentSum
return maxSum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment