Recursive
Code
# Code
```cpp []
class Solution {
public:
    int minimumPairRemoval(vector<int>& nums) {
        int n = nums.size();
        int minSum = INT_MAX;
        int idx = -1;
        bool sorted = true;
        for (int i = 1; i < n; i++) {
            int sum = nums[i - 1] + nums[i];
            if (nums[i] < nums[i - 1]) sorted = false;
            if (sum < minSum) {
                minSum = sum;
                idx = i - 1;
            }
        }
        if (!sorted) {
            nums[idx] += nums[idx + 1];
            nums.erase(nums.begin() + idx + 1);
            return minimumPairRemoval(nums) + 1;
        }
        return 0;
    }
};
```
['C++']