Problem
You are given a list nums of even length n. Split it into n / 2 pairs so that every element is in exactly one pair. The pair sum of a pair is its two values added together. Arrange the pairs to make the largest pair sum as small as possible, and return that value.
Example 1
- Input
- nums = [3, 5, 2, 3]
- Output
- 7
- Why
- pairs (3, 3) and (5, 2): max(6, 7) = 7
Example 2
- Input
- nums = [3, 5, 4, 2, 4, 6]
- Output
- 8
- Why
- pairs (3, 5), (4, 4), (6, 2)
Constraints
n == nums.length2 <= n <= 10^5n is even.1 <= nums[i] <= 10^5