3507. Minimum Pair Removal to Sort Array I
IntuitionSimulation - do that is ask in the questionApproachCreate new list and  add all the elements and performs all the operationComplexity

Time complexity:
# Intuition
Simulation - do that is ask in the question 

# Approach
Create new list and  add all the elements and performs all the operation 

# Complexity
- Time complexity:- 0(n^2)


- Space complexity:-0(n)


# Code
```java []
class Solution {
    public boolean isSorted(List<Integer> list) {
        for (int i = 0; i < list.size() - 1; i++) {
            if (list.get(i) > list.get(i + 1))
                return false;
        }
        return true;
    }

    public int minimumPairRemoval(int[] nums) {
        int n = nums.length;
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nums[i]);

        }

        int cnt = 0;
        while (isSorted(list) != true) {
            int min = Integer.MAX_VALUE;
            int minIdx = -1;
            for (int i = 0; i < list.size() - 1; i++) {

                if (min > (list.get(i) + list.get(i + 1))) {
                    minIdx = i;
                    min = (list.get(i) + list.get(i + 1));

                }

            }
            list.set(minIdx, min);
            for (int i = minIdx + 1; i < list.size() - 1; i++) {
                list.set(i, list.get(i + 1));
            }
            list.remove(list.size()-1);
            cnt++;

        }
        return cnt;
    }
}
```
['Java']