Sorted Harmony, Through Pair Fusion Achieved
IntuitionDisorder in the array, you sense? Fix it with minimum effort, we must. By merging the pair with the smallest sum, order we approach. Always the leftmos
# Intuition
Disorder in the array, you sense? Fix it with minimum effort, we must. By merging the pair with the smallest sum, order we approach. Always the leftmost such pair, we choose.

# Approach
1. While the array is not sorted in non-decreasing order:
    - Find the adjacent pair with the minimum sum.
    - Merge them into one element (replace with the sum), reduce array size.
    - Repeat, until peace (sorting) is achieved.
2. Count how many such operations are needed.
Patience and precision, the path to order is.

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

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

# Code
```cpp []
class Solution {
public:
    int minimumPairRemoval(vector<int>& nums) {
        int x=0,b;
        while (nums.size()>1){
            b=1;
            for (int i=1;i<nums.size();i++){
                if (nums[i-1]>nums[i]){b=0;}
            }
            if (b==1){break;}
            x++;
            int ma=INT_MAX;
            for (int i=1;i<nums.size();i++){
                if (nums[i]+nums[i-1]<ma){ma=nums[i-1]+nums[i];}
            }
            for (int i=1;i<nums.size();i++){
                if (nums[i]+nums[i-1]==ma){
                    nums[i-1]=nums[i-1]+nums[i];
                    nums.erase(nums.begin()+i);
                    break;
                }
            }
        }
        return x;
    }
};
```
['C++']