VERY EASY SOLUTION(C++)
IntuitionApproachFind the smallest consecutive pair by their sum.Merge this pair and repeat until the array is non-decreasing.Track the number of operations.Com
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->
Find the smallest consecutive pair by their sum.

Merge this pair and repeat until the array is non-decreasing.

Track the number of operations.



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

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

# Code
```cpp []
class Solution {
public:
    bool decrese(vector<int>&nums){
        for(int i = 1;i<nums.size();i++){
            if(nums[i]<nums[i-1]){
                return false;
            }
        }
        return true;

    }
        
    int minimumPairRemoval(vector<int>& nums) {
        int count= 0;
        while(!decrese(nums)){
            int min = INT_MAX;
            int index= -1;

            for(int i = 0;i<nums.size()-1;i++){
                int sum = nums[i]+nums[i+1];
                if(sum<min){
                    min= sum;
                    index=i;
                }
            }

            vector<int>temp;
            for(int i=0;i<nums.size();i++){
                if(i==index){
                    temp.push_back(nums[i]+nums[i+1]);
                    i++;
                }
                else temp.push_back(nums[i]);


            }
            nums=temp;
            count++;
        }
        return count;
        
        
    }
};
```
['C++']