Fr example if the list stores 1 7 3 9 4 6 5 your method


Write a method called compress that replaces every pair of elements in the list with a single element equal to the sum of the pair. If the list is of odd size, leave the last element unchanged. For example, if the list stores [1, 7, 3, 9, 4, 6, 5], your method should change it to store [8, 12, 10, 5] (1 + 7, then 3 + 9, then 4 + 6, then 5).

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Fr example if the list stores 1 7 3 9 4 6 5 your method
Reference No:- TGS02209462

Expected delivery within 24 Hours