✅ C++ | 3 lines | explanation | O(n) time | O(1) space
As we do not need to sort the array, just compare the consecutive elements\n if they are equal, increment the ans\n else just skip\n last check would be, if the
* As we do not need to sort the array, just compare the consecutive elements\n* if they are equal, increment the ```ans```\n* else just skip\n* last check would be, if the vector size is even or not\n* as ```ans = number of deletions```, ```size of vector - ans``` would mean the final vector size after deletions. if it is odd, increase ```ans```, as that would mean we deleted one more element to make size of ```nums``` even\n```\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        int ans=0, n=nums.size();\n        for(int i=0;i<n-1;i++)  nums[i]==nums[i+1] ? ans++ : i++;\n        return ans + ((n - ans) % 2);\n    }\n};\n```
['C']