Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def maxSequence(arr):
- if arr==[]:
- return 0
- summlocal=0
- summglobal=0
- for i in arr:
- if summlocal>=0:
- if summlocal+i <0:
- summlocal=0
- else:
- summlocal+=i
- summglobal=max(summlocal,summglobal)
- return summglobal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement