compress (xs)
Description: It reduces a two-dimensional list xs with size MxN into a two-dimensional list with half the
size in both dimensions (i.e M/2 x N/2), where the new elements are the sum of the corresponding 4
elements. M and N are guaranteed to be even numbers.
Parameters: xs (list of list of int)
Return value: None. The list xs is modified in place. Slicing is not allowed.
Examples:
compress([[1, 2, 3, 4, 5, 6],
[7, 8, 9, 10, 11, 12]])
?
[[18, 26, 34]]
compress ([ [1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12],
[13, 14, 15, 16]])
?
[[14, 22],
[46, 54]]