Skip to content

Instantly share code, notes, and snippets.

@sreevidyavutukuru
Created August 10, 2017 03:34
Show Gist options
  • Save sreevidyavutukuru/5a00505a49906caf23924b1fb3bcea1a to your computer and use it in GitHub Desktop.
Save sreevidyavutukuru/5a00505a49906caf23924b1fb3bcea1a to your computer and use it in GitHub Desktop.
list1 = [-2,-1,4,-1,-2,1,5,-3]
def maxsum(list1):
if list1 != None:
max_so_far = list1[0]
max_here = list1[0]
for val in list1[1:]:
max_here = max_here + val
if max_here> max_so_far :
max_so_far = max_here
if max_here <0:
max_here = 0
return max_so_far
print maxsum(list1)
@since1991qsy
Copy link

hi sreevidyavutukuru,

I am new to Gist. I am wondering how can I type in python code.

'''python
if a is None:
return True
'''

Unfortunately, this didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment