Simple C++ Solution with comments - O(N) time, O(1) space
\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        int n = nums.size();\n        int vindex = 0, ans = 0;  // vindex -> virtual inde
```\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        int n = nums.size();\n        int vindex = 0, ans = 0;  // vindex -> virtual index after deletion of the the element from array\n        \n        for(int i=0; i<n; i++){\n            if(vindex%2==0){     // if vindex is even then only you need to check further conditions\n                if(i+1!=n && nums[i] == nums[i+1]){\n                    ans++;\n                    vindex--; // after deleting the element vindex will shift left by one\n                }\n            }\n            vindex++; // if deletion of the element is not there vindex will shift right by one\n        }\n        if((n-ans) % 2) ans++; // if after deletions array is of odd length, delete one more element\n        return ans;\n    }\n};\n```
['C']