Write a function to find the maximum sum of sub array where the array can have negative and positive numbers.
Anonymous
In Python: def largest_segment(s): y = 0 z = 0 for i in range(0, len(s)): y = max(y + s[i], 0) z = max(z, y) return z Algorithm is O(n). Only works if the max value for an array containing all negatives is 0.
Check out your Company Bowl for anonymous work chats.