[Python 3] Two Pointer Greedy Solution
Approach:\nInitialise steps to 0.\nUse two pointers, one to iterate through the array and other to keep track of the index in the updated list after removing (a
**Approach**:\nInitialise steps to 0.\nUse two pointers, one to iterate through the array and other to keep track of the index in the updated list after removing (as the indices will change because of shifting).\n\nIf the index is not divisible by 2, then increment the index by 1. Otherwise, taking care of an edge case of i=len(nums)-1 and if the element is equal to the next element, then increment steps by 1 and keep the index the same (as this element would be deleted), otherwise, increment the index by 1.\n\nIn the end, if the len of the updated list (index) is divisible by 2, then return steps, otherwise, we would need to delete another element and hence return steps+1.\n\n**Time Complexity**: O(n) - we iterate the list once\n**Space Complexity**: O(1) \n\n**DO UPVOTE IF YOU FOUND IT HELPFUL.**\n\n**Code**:\n```\nclass Solution:\n    def minDeletion(self, nums: List[int]) -> int:\n        i = index = steps = 0\n        while i < len(nums):\n            if index%2 != 0:\n                index += 1\n            else:\n                if i == len(nums)-1:\n                    index += 1\n                    break\n                if nums[i] == nums[i+1]:\n                    steps += 1\n                else:\n                    index += 1\n            i += 1\n        \n        return steps if index%2 == 0 else steps+1\n```
['Two Pointers', 'Greedy', 'Python', 'Python3']