Easy Stack Solution with comments
\nclass Solution {\n    public int minDeletion(int[] nums) {\n        int currIdx = -1;\n        int ans = 0;\n        // stores beautiful array on the go\n    
```\nclass Solution {\n    public int minDeletion(int[] nums) {\n        int currIdx = -1;\n        int ans = 0;\n        // stores beautiful array on the go\n        Stack<Integer> st = new Stack<>();\n        for(int i : nums) {\n            if (st.isEmpty() || st.peek()!=i || currIdx%2!=0) {\n                st.push(i);\n                currIdx++;\n            } else if(currIdx % 2 == 0 && st.peek()==i) {\n               ans++;                 \n            }\n        }\n        // if odd ...remove last element\n        if(st.size()%2==1) {\n            ans++;\n        }\n        \n        return ans;\n        \n    }\n}\n```
['Stack', 'Java']