C++ | Shortest solution | Easy to comprehend | O(n) time | constant space
\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        int n=nums.size(), ctr=0, op=0;\n        for(int i=0; i<n-1; i++,ctr++) {\n      
```\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        int n=nums.size(), ctr=0, op=0;\n        for(int i=0; i<n-1; i++,ctr++) {\n            if(!(ctr&1)) while(i+1<n&&nums[i+1]==nums[i]) i++, op++;\n        }\n        return (ctr&1)?op+1:op;\n    }\n};\n```
[]