Python two pointers without using extra space
\nclass Solution:\n    def applyOperations(self, nums: List[int]) -> List[int]:\n        \n        for i in range(len(nums) - 1):\n            if nums[i] == num
```\nclass Solution:\n    def applyOperations(self, nums: List[int]) -> List[int]:\n        \n        for i in range(len(nums) - 1):\n            if nums[i] == nums[i+1]:\n                nums[i] = nums[i] * 2\n                nums[i+1] = 0\n        \n        l = 0\n        \n        for r in range(len(nums)):\n            if nums[l] ==0 and nums[r] !=0:\n                nums[l], nums[r] = nums[r], nums[l]\n                l += 1\n            elif nums[l] !=0:\n                l += 1\n        \n        return nums\n```
['Two Pointers', 'Python']