Interesting List
CodeChefOpen on judge ↗
The Problem is simple. You will be given n integers .Find an arrangement of these n integers so that summation of the absolute differences between adjacent elements is maximized. Suppose n = 4 and the given integers are . The re-arrangement yields the maximum summation. For this arrangement, sum = abs(2-5) + abs(5-1) + abs(1-4) = 3+4+3 = 10. Of all the 24 different arrangements of the above list,
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start