Maximum subarray problem: Difference between revisions

Content deleted Content added
Undid revision 348332996 by 140.112.229.66 (talk)
Line 10:
max_so_far = max_ending_here = 0
for x in A:
max_ending_here = max(0, max_ending_here) + x)
max_so_far = max(max_so_far, max_ending_here)
return max_so_far