Created
October 3, 2015 21:25
-
-
Save brandonlee503/1cd669d320fa3e5d8c22 to your computer and use it in GitHub Desktop.
CS 325 Algorithms HW 1 Problem 3
This file contains hidden or 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
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