Clean Simulation Brute Force solution beats 100% runtime [C++]
Complexity

Time complexity: O(n2)


Space complexity: O(1)

Code
# Complexity
- Time complexity: $$ O(n^2)$$

- Space complexity: $$ O(1) $$

# Code
```cpp []
class Solution {
public:
    int minimumPairRemoval(vector<int>& nums) {
        int operations = 0;

        while (!isSorted(nums)) {
            int minSum = minPair(nums);

            for (int i = 1; i < nums.size(); i++) {
                int sum = nums[i] + nums[i - 1];
                if (sum == minSum) {
                    nums[i - 1] = sum;
                    nums.erase(nums.begin() + i);
                    operations++;
                    break;
                }
            }
        }
        return operations;
    }

private:
    bool isSorted(vector<int>& nums) {
        for (int i = 1; i < nums.size(); i++) {
            if (nums[i] < nums[i - 1])
                return false;
        }
        return true;
    }

    int minPair(vector<int>& nums) {
        int minSum = 100000;
        for (int i = 1; i < nums.size(); i++) {
            int sum = nums[i] + nums[i - 1];
            minSum = min(minSum, sum);
        }
        return minSum;
    }
};
```
['Array', 'Simulation', 'C++']