C++,Simple O(n) and O(1) solution
In this First of all we will check if the give array is empty or of size 1, if so then we will simply return 0;\nNow, for the real test cases...\nwe will mainta
In this First of all we will check if the give array is empty or of size 1, if so then we will simply return 0;\nNow, for the real test cases...\nwe will maintain a "K" which will store the no. of elements we will delete.\nNow for every index we will check for (i-k)%2 coz ,index of elements will be sifted to left when we delete any element so for that i-k will give us the new and correct position.\n\nand at last we just need to check wheather the size of our new array is even or not if not we will delete one more element and that it.\n\nhope you understand.\n\n```\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        if(nums.size()==0 && nums.size()==1)\n        {\n            return 0;\n        }\n        int k=0;\n        for(int i=0;i<nums.size()-1;i++)\n        {\n            if((i-k)%2==0)\n            {\n                if(nums[i]==nums[i+1])\n                {\n                    k++;\n                }\n            }\n        }\n        if((nums.size()-k)%2!=0)\n        {\n            k++;\n        }\n        return k;\n    }\n};\n```
['C', 'Iterator']