Python | Greedy
```\nclass Solution:\n    def minDeletion(self, nums: List[int]) -> int:\n        # Greedy !\n        # we first only consider requirement 2: nums[i] != nums[i 
```\nclass Solution:\n    def minDeletion(self, nums: List[int]) -> int:\n        # Greedy !\n        # we first only consider requirement 2: nums[i] != nums[i + 1] for all i % 2 == 0\n        # at the begining, we consider the num on the even index\n        # when we delete a num, we need consider the num on the odd index\n        # then repeat this process\n        # at the end we check the requirement 1: nums.length is even or not\n        \n        n = len(nums)\n        count = 0\n        # flag is true then check the even index\n        # flag is false then check the odd index\n        flag = True\n        \n        for i in range(n):\n            # check the even index\n            if flag:\n                if i % 2 == 0 and i != n -1 and nums[i] == nums[i + 1]:\n                    count += 1\n                    flag = False\n            # check the odd index\n            elif not flag:\n                if i % 2 == 1 and i != n -1 and nums[i] == nums[i + 1]:\n                    count += 1\n                    flag = True\n        \n        curLength = n - count\n        \n        return count if curLength % 2 == 0 else count + 1
['Greedy', 'Python', 'Python3']