C++ | Short and Easy | Shifting positions
Let s=number of times to shift left. If we delete element from array, we have to increase it.\nthen i-s will be new position after shifting by s number of times
Let s=number of times to shift left. If we delete element from array, we have to increase it.\nthen i-s will be new position after shifting by s number of times to left\n```\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        int ans=0;\n        int s=0;\n        int n=nums.size();\n        for(int i=1;i<n;i++){\n            int pos=i-s;\n            if(pos%2==1){\n                if(nums[i]==nums[i-1]){\n                    ans++;\n                    s++;\n                }\n            }\n        }\n        int m=n-ans;\n        if(m%2==1)ans++;\n        return ans;\n    }\n};
['C']