Python Solution
Code
# Code
```python []
class Solution:
    def applyOperations(self, nums: List[int]) -> List[int]:
        for i in range(len(nums) - 1):
            if nums[i] and nums[i] == nums[i + 1]:
                nums[i] *= 2
                nums[i + 1] = 0
        return sorted(nums, key=lambda x: not x)
```
['Python3']