Best sum of pair minimums
Split 2N numbers into N pairs so that the sum of the smaller number in each pair is as large as possible. Print that sum.
Reported in: Capgemini (2026 batch) (memory-based)
Input
First line: 2N (an even number). Second line: the 2N integers.
Output
The largest possible sum of pair minimums.
Constraints
2 ≤ 2N ≤ 10^5.
Example 1
Input:
4
1 4 3 2
Output:
4Example 2
Input:
6
6 2 6 5 1 2
Output:
9Hint: Sort, then pair neighbours: add every second element starting from the first.