Given a number N and an array of N integers, find the minimum sum of the maximum elements obtained by considering all consecutive pairs of adjacent elements after rearranging the array suitably.
Input Size : N <= 100000
Sample Testcase :
INPUT
5
1 2 3 4 5
OUTPUT
18
Comments
(6)
Please login to comment.