Simple and Easy || Beats 100% 💯💪||Just follow the instructions and ur their 🚀 || C++
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) {
        
//     }
// };
class Solution {
public:
    bool isNonDecreasing(const vector<int>& nums) {
        for (int i = 0; i + 1 < 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 index = -1;

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

            // Merge nums[index] and nums[index + 1]
            int merged = nums[index] + nums[index + 1];
            nums.erase(nums.begin() + index, nums.begin() + index + 2);
            nums.insert(nums.begin() + index, merged);
            ++ops;
        }

        return ops;
    }
};
```
['C++']