100% beats
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int minimumPairRemoval(vector<int>& nums) {
        int result = 0;
        while(!isSorted(nums)){
            merge(nums);
            result++;
        }
        return result;
    }
    bool isSorted(vector<int>& nums){
        for(int i=0;i<nums.size()-1;i++){
            if(nums[i]>nums[i+1])
            return false;
        }
        return true;
    }
    void shiftleft(vector<int>& nums,int idx){
       for(int i = idx;i<nums.size()-1;i++){
        nums[i]=nums[i+1];
       }
       nums.pop_back();
    }
    void merge(vector<int>& nums){
         int min;
        int minValue = INT_MAX;
        for(int i=0;i<nums.size()-1;i++){
            int sum = nums[i]+nums[i+1];
            if(sum<minValue){
                minValue = sum;
                min = i;
            }
        }
        nums[min]=minValue;
        shiftleft(nums,min+1);
    }
};
```
['C++']