find max consecutive sum, find segments containing a point
1) Given an array of integers (negative and positive) - what is the most efficient algorithm to return the max consecutive sum.

a) I thought to solve this with Dynamic Programing, but complexity is O(n^2). Is there another way?
b) What if we were given a infinite input of integers. Is there a way to output the current max consecutive sum? I guess not.

2) Given: an array of segments[start,end] (can elapse) ordered by start point, 
and a point. 

What is the most efficient algorithm to return a segment that contains this point?/all segments that contain this point?
I thought to use binarySearch to hit the first segment that starts before this point the than trying to traverse right and left. 


Any other idea ? 

 
find max consecutive sum, find segments containing a point
===

1) Given an array of integers (negative and positive) - what is the most efficient algorithm to return the max consecutive sum.

a) I thought to solve this with Dynamic Programing, but complexity is O(n^2). Is there another way?
b) What if we were given a infinite input of integers. Is there a way to output the current max consecutive sum? I guess not.

2) Given: an array of segments[start,end] (can elapse) ordered by start point, 
and a point. 

What is the most efficient algorithm to return a segment that contains this point?/all segments that contain this point?
I thought to use binarySearch to hit the first segment that starts before this point the than trying to traverse right and left. 


Any other idea ? 

 