Question: /** * @param list * @return sum of those items that are more than the items after them. * return 0 if list is null

/**

* @param list

* @return sum of those items that are more than the items after them.

* return 0 if list is null

* for example,

* if list = [20, 50, 80, 60, 30], return 80 + 60 = 140

* if list = [70, 50, 80, 10, 40, 40, 20], return 70 + 80 + 40 = 190

* if list = [10, 20, 30, 30, 30], return 0

* if list = [], return 0

*/

public static int sumItemsMoreThanNext(ArrayList list) {

return 0; //to be completed

}

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!