Dark Mode
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Example 1: Input: [1,4,3,2]
Output: 4 Explanation: n is 2, and the maximum sum of pairs is 4 = min(1, 2) + min(3, 4).
Solution: O(n log n) General idea is to pair the smallest with the next smallest value inorder