### Problem
Partition the 2n elements of nums into n pairs, using every occurrence once. Return the greatest possible sum of the smaller value in each pair.
```cpp
class Solution {
public:
int arrayPairSum(vector<int>& nums);
};
```
### Examples
**Example 1:**
```text
nums = [8,1,7,2]
Output: 8
Explanation: Pair (1,2) and (7,8), giving 1+7.
```
**Example 2:**
```text
nums = [-4,-1,2,3]
Output: -2
Explanation: Adjacent sorted pairs contribute -4+2.
```
### Constraints
- For n in 1..10000 there are exactly 2n input entries. Values are in -10000..10000.
### Clarifying Questions
Use all occurrences exactly once and justify why pairing the two smallest remaining values is safe.
```hint Read the boundary condition
Can a pairing of the smallest two values be exchanged into any optimum?
```
### Contract considerations
Use all occurrences exactly once and justify why pairing the two smallest remaining values is safe.
Overview: Maximize the Sum of Pair Minima. Partition the 2n elements of nums into n pairs, using every occurrence once.