C++ Time - O(N)  Space - O(1)
Code\n\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        vector<int>vec;\n        int ans=0,s=nums.size(),j=0;\n        if(s==1)\n  
# Code\n```\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        vector<int>vec;\n        int ans=0,s=nums.size(),j=0;\n        if(s==1)\n        return 1;\n        \n        for(int i=0;i<nums.size()-1;i++){\n            if(j%2==0){\n                if(nums[i]==nums[i+1]){\n                     ans++;\n                     s--;\n                     continue;\n                }\n            }\n            j++;\n        }\n\n        if(s%2==1)\n         ans++;\n\n         return ans;\n    }\n};\n```
['C++']