Intutive greedy stack approach
Literally do what the questions says\n\n# Code\n\nclass Solution {\n    public int minDeletion(int[] nums) {\n        return util1(nums);\n    }\n    public int
Literally do what the questions says\n\n# Code\n```\nclass Solution {\n    public int minDeletion(int[] nums) {\n        return util1(nums);\n    }\n    public int util1(int[] arr) {\n        Stack<Integer> s = new Stack<>();\n        int operations = 0;\n        for (int i : arr) {\n            if (s.isEmpty() == false && (s.peek() == i && (s.size() - 1) % 2 == 0)) {\n                operations++;\n            } else {\n                s.push(i);\n            }\n        }\n        while (s.size() % 2 != 0) {\n            operations++;\n            s.pop();\n        }\n        return operations;\n    }\n}\n```\nyou can check out my github repository where i am uploading famous interview questions topic wise with solutions.\nlink-- https://github.com/Abhaydutt2003/DataStructureAndAlgoPractice \nkindly upvote if you like my solution. you can ask doubts below.\xAF\n    \n
['Stack', 'Greedy', 'Java']