Given an array of n integers, rearrange
them so that the sum of the absolute
differences of all adjacent elements is
minimized. Then, compute the sum of those
absolute differences.
16
IND
1
Example
n = 5
arr = [1, 3, 8, 2, 4
19
2
.
If the list is rearranged as a = 2, 3, 34).
the absolute differences are 1-2/=, 2-
3/ = 1, 3-3/ = 0 3-4 = . The sum of
those differences is + + 0 = 3
3
Answers
Answered by
1
Answer:
i don't know sorry
Explanation:
BECAUSE I DON'T KNOW
Similar questions