Question: Consider a list such as: [ 1 , 2 , 4 , 1 , 6 , 8 , 2 , 3 , 5 , 4

Consider a list such as: [1,2,4,1,6,8,2,3,5,4,9]
We wish to identify the sum of the numbers in the contiguous subsequence of the list that is in non-decreasing order which produces the maximum sum.
Specifically, the above list has multiple contiguous subsequences that are sorted in ascending order, and for each of them we can get their respective sums. In our case, this gives:
1,2,4 which sums to 7
1,6,8 which sums to 15
2,3,5 which sums to 10
4,9 which sums to 13

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!