Skip to content

Instantly share code, notes, and snippets.

@mvallebr
Last active November 5, 2016 21:41
Show Gist options
  • Select an option

  • Save mvallebr/4ce17e5d73da155f08a4a08b007f6359 to your computer and use it in GitHub Desktop.

Select an option

Save mvallebr/4ce17e5d73da155f08a4a08b007f6359 to your computer and use it in GitHub Desktop.
def maxSequence(arr):
max_sum = 0
current_sum = 0
for i in arr:
current_sum += i
current_sum = max(current_sum, i)
max_sum = max(current_sum, max_sum)
return max_sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment