C++ using stack
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n// #include<stack>\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        int deletions = 0;\n        stack<int>st;\n        for(int i=0;i<nums.size();++i){\n            if(!st.empty() && st.top() == nums[i] && st.size() %2 !=0){\n                deletions++;\n            }else{\n                st.push(nums[i]);\n            }\n        }\n        if(st.size() % 2 != 0){\n            deletions++;\n        }\n        return deletions;\n    }\n};\n```
['C++']