Minimum Deletions to Make Array Beautiful
\n# First I am looking for value at index even and repeating at the next index. \n# If it occurs means one deletion means now all values shifts to even, and eve
```\n# First I am looking for value at index even and repeating at the next index. \n# If it occurs means one deletion means now all values shifts to even, and even shifted to odd.\n# for example [1,1,2,2,3,3] at 0th index we found a repeating element \n# Now after deletion [1,2,2,3,3] becomes new array and now 2 is not at even index so we can\'t delete it as well as for 3.\n# after doing all this we have deleted one index and size is now 5 so we have deleted one element from end \n# that will not disturb the index of other values\n# So for doing this we need 2deletions\n# for maitiaining shift we are subtracting deletion count with current index(KEY)\n```\n```\nclass Solution \n{\n public:\n    int minDeletion(vector<int>& nums) \n    {\n        int n=nums.size();\n        int ans=0;\n        for(int i=0;i<n-1;i++)\n        {\n            if((i-ans)%2==0 && nums[i+1]==nums[i])\n                 ans++; \n        }\n        if((n-ans)%2)\n            ans++;\n        return ans;\n    }\n};\n```
['Greedy', 'C', 'C++']