JAVA || STACK || EASY || EXPLAINATION
Here in order to solve this question we need to consider some cases and need to keep those in our mind:\n If stack has even elements that\'s if(stk.size()%2==0)
Here in order to solve this question we need to consider some cases and need to keep those in our mind:\n* If stack has even elements that\'s `if(stk.size()%2==0)` then we know that only even indexes are needed to be considered as per real-time arraty so we just add that number in stack\n* Now second case is when we have odd numbers in stack then we just need to check two more thing:\n\t\t\t1. if stk peek element is same then we don\'t put the current element and increase the count\n\t\t\t2. if not same then simply put that value\n\n**Read it carefully it\'s a beautiful question too LOL**\n\n```\nclass Solution {\n    public int minDeletion(int[] nums) {\n        Stack<Integer> stk = new Stack<>();\n        int n = nums.length;\n        int count=0;\n        for(int i=0;i<nums.length;i++){\n            if(!stk.isEmpty()){\n                if(stk.size()%2==0){\n                    stk.add(nums[i]);\n                }else{\n                    if(stk.peek()==nums[i]) count++;\n                    else stk.add(nums[i]);\n                }\n            }else{\n                stk.add(nums[i]);\n            }\n        }\n        if(stk.size()%2==1) count++;\n        return count;\n    }\n}\n```
['Stack', 'Greedy', 'Java']