Design a linear algorithm that finds a contiguous subsequence of at
most M in a sequence of N long integers that has the highest sum among
all such subsequences. Implement your algorithm, and confirm that the
order of growth of its running time is linear.
I’ve read it a couple of times, but I’m having a difficult time understanding what it wants me to do.
Suppose that you have 10 integers in a line. You can pick any 1,2 or 3 of them in sequence and add them up. You need to find out which ones you would pick so that the sum is maximum. In this case M=3, N=10.
Your algorithm must run in linear time.