C++ Solution Using Deque
\'\'\'\n\n    int minDeletion(vector& nums) {\n        deque p,q;\n        int ans=0;\n        \n        for(int i=0;i<nums.size();i++)\n        {\n            
\'\'\'\n\n    int minDeletion(vector<int>& nums) {\n        deque<int> p,q;\n        int ans=0;\n        \n        for(int i=0;i<nums.size();i++)\n        {\n            p.push_back(nums[i]);\n        }\n        \n        q.push_back(p.front());\n        p.pop_front();\n        \n        while(!p.empty())\n        {\n            while(!p.empty() && q.back()==p.front())\n            {\n                p.pop_front();\n                ans++;\n            }\n            while(!p.empty() && q.back()!=p.front())\n            {\n                q.push_back(p.front());\n                p.pop_front();\n                if(!p.empty())\n                {\n                    q.push_back(p.front());\n                    p.pop_front();\n                }\n            }\n        }\n        \n        if(q.size()%2==1)\n        {\n            q.pop_back();\n            ans++;\n        }\n        \n        return ans;\n    }\n\t\n\t\'\'\'
['Queue', 'C']