Using ArrayList || Simple brute force || Beginner friendly
💡 Intuition:We are allowed to merge adjacent pairs with the minimum sum, and we aim to make the array non-decreasing in as few operations as possible.
To simula
# 💡 Intuition:
We are allowed to merge adjacent pairs with the minimum sum, and we aim to make the array non-decreasing in as few operations as possible.
To simulate the process, we repeatedly:

Find the leftmost adjacent pair with the minimum sum.

Merge the pair by replacing it with their sum.

Continue until the array becomes non-decreasing.

# 🧠 Approach:
Convert the input array into a List<Integer> for easier removal of elements during merging.

While the list is not non-decreasing:

Scan the list to find the leftmost pair with the minimum sum.

Merge this pair (i.e., replace both with their sum, keeping only one element).

Increment the operation counter.

Return the total number of operations once the array becomes non-decreasing.

# ✅ Why It Works:
By always merging the pair with the smallest sum, we minimize the impact on the rest of the array and move closer to a non-decreasing order without making unnecessary merges.

# 🔢 Time Complexity:
O(n³) worst-case in theory due to repeated scans and removals.

But practically efficient for n ≤ 50 due to fast array manipulation in Java ArrayList.

# Code
```java []
import java.util.*;

public class Solution {
    public int minimumPairRemoval(int[] nums) {
        List<Integer> list = new ArrayList<>();
        for (int num : nums) list.add(num);

        int ops = 0;

        while (!isNonDecreasing(list)) {
            int minSum = Integer.MAX_VALUE;
            int minIdx = 0;

            for (int i = 0; i < list.size() - 1; i++) {
                int sum = list.get(i) + list.get(i + 1);
                if (sum < minSum) {
                    minSum = sum;
                    minIdx = i;
                }
            }

            // Merge the pair
            int merged = list.get(minIdx) + list.get(minIdx + 1);
            list.set(minIdx, merged);
            list.remove(minIdx + 1);
            ops++;
        }

        return ops;
    }

    private boolean isNonDecreasing(List<Integer> list) {
        for (int i = 1; i < list.size(); i++) {
            if (list.get(i) < list.get(i - 1)) return false;
        }
        return true;
    }
}

```
['Java']