Maximize Differences
InterviewTime limit1sMemory limit256 MB
Reorder the given array so the sum of absolute differences between neighbors is as large as possible.
Problem
Reorder the array to maximize the sum of adjacent absolute differences.
Input
N and array A.
Output
Print the maximum value.