3 Different Solutions [Simple, Greedy and Faster ]
This solution is based on a approch that we need a pair who has distinct elements (That\'s what the ques saying basically)\n\'\'\'\n\n    def minDeletion(self, 
This solution is based on a approch that we need a pair who has distinct elements (That\'s what the ques saying basically)\n\'\'\'\n\n    def minDeletion(self, nums: List[int]) -> int:\n        ans =0 \n        l=None\n        for i in nums:\n            if l is None:\n                l=i\n            elif l!=i:\n                l=None\n                ans+=2\n        return len(nums)-ans\n\'\'\'\n#This is a Stack solution where we append the first value and second value(only if it is different)\n\'\'\'\n\n    def minDeletion(self, nums: List[int]) -> int:\n        stack=[]\n        l=len(nums)\n        \n        for i in nums:\n            if len(stack)%2==0:\n                stack.append(i)\n            elif stack[-1]!=i:\n                stack.append(i)\n        if len(stack)%2==0:\n            return l-len(stack)\n        else:\n            return l-len(stack)+1\n\'\'\'\n#In This we take a shift index that tells us the index of element if we delete that element .\n\'\'\'\n    \n\tdef minDeletion(self, nums: List[int]) -> int:\n        count=0\n        for i in range(len(nums)-1):\n            shift_index=i-count\n            if nums[i]==nums[i+1] and shift_index%2==0:\n                count+=1\n        if(len(nums)-count)%2==1:\n            count+=1\n        return count\n\'\'\'
['Greedy', 'C', 'Python']