EASY C++ SOLUTION 😊😊😁
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:
    bool isNondecreasing(const 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 ops = 0;

        while (!isNondecreasing(nums)) {
            int minSum = INT_MAX;
            int minIndex = -1;

            // Find the adjacent pair with the minimum sum
            for (int i = 0; i < nums.size() - 1; i++) {
                int pairSum = nums[i] + nums[i + 1];
                if (pairSum < minSum) {
                    minSum = pairSum;
                    minIndex = i;
                }
            }

            // Replace nums[minIndex] and nums[minIndex+1] with their sum
            int combined = nums[minIndex] + nums[minIndex + 1];
            vector<int> newNums;

            for (int i = 0; i < nums.size(); i++) {
                if (i == minIndex) {
                    newNums.push_back(combined);
                    i++; // Skip the next one (i+1)
                } else {
                    newNums.push_back(nums[i]);
                }
            }

            nums = newNums;
            ops++;
        }

        return ops;
    }
};

```
['C++']