Easiest way
Approach
If equal multiply by 2 (n * 2)
If result is zero (0) store it and don't add to result
Combine result and zeros (spread operator ...)
Complexity

Time c
# Approach
1. If equal multiply by 2 (n * 2)
2. If result is zero (0) store it and don't add to result
3. Combine result and zeros (spread operator ...)

# Complexity
- Time complexity:
O(n)

- Space complexity:
O(n) (IMO)

# Upwote if you want, I don't beg

# Code
```typescript []
function applyOperations(nums: number[]): number[] {
    const res = []
    const zeros = []

    for (let i = 0; i < nums.length; i++) {
        if (nums[i] === nums[i + 1]) {
            [nums[i], nums[i + 1]] = [nums[i] * 2, 0]
        }

        if (nums[i] === 0) zeros.push(0)
        else res.push(nums[i])
    }


    return [...res, ...zeros]
};
```
['TypeScript']