Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. def maxSequence(arr):
  2. if arr==[]:
  3. return 0
  4. summlocal=0
  5. summglobal=0
  6. for i in arr:
  7. if summlocal>=0:
  8. if summlocal+i <0:
  9. summlocal=0
  10. else:
  11. summlocal+=i
  12. summglobal=max(summlocal,summglobal)
  13. return summglobal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement