Maximal Contiguous Sum

More Details

A contiguous subsequence is a subsequence made up of consecutive elements.

For the list {a, b, c, d, e}, the subsequence {b, c, d} is contiguous, whereas {a, b, e} is not.

What Your Code Should Do

Given a list of integers, write a function LargestContiguousSum that returns the largest sum of a contiguous subsequence.

LargestContiguousSum[{-2}]

LargestContiguousSum[{1,2,3,4,5,-1,7}]

LargestContiguousSum[{2,5,10,7,3,-2,10,-1,-8,-3,-5,6,6,-9,4,-7,-10,6,6,-9}]

The largest contiguous sum for the following list is 36 and is generated by the subsequence {6, 5, -4, 1, 5, 4, 2, 4, 7, 6} (which starts with the 30th element):

LargestContiguousSum[{9,-9,-10,5,-9,-4,0,2,-5,-2,10,-10,9,-6,-5,-10,9,5,1,0,-9,-4,-8,-8,-2,-8,-7,-2,-7,6,5,-4,1,5,4,2,4,7,6,-4,-8,-10,10,5,-1,-7,2,-6,-4,6,-1}]

For a list with non-negative elements, the answer is the sum over the whole list:

LargestContiguousSum[{1,2,3,4,5,6,7}]

LargestContiguousSum[numbers_List] :=