Easy Beginner Friendly Solution 🔥  ✅  ⭐️  Simple Logic 💡
Intuitionas per the question If nums[i] == nums[i + 1], we multiply nums[i] by 2 and set nums[i + 1] to 0. then we just moving the zeros to the end .ApproachIf
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
as per the question If nums[i] == nums[i + 1], we multiply nums[i] by 2 and set nums[i + 1] to 0. then we just moving the zeros to the end .

# Approach

 If it helps Please Upvote ⬆️ ⬆️ ⬆️
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
- O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
- O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->


# Code
```javascript []
/**
 * @param {number[]} nums
 * @return {number[]}
 */
var applyOperations = function (nums) {
    let res = 0;
    for (let i = 0; i < nums.length; i++) {
        if (nums[i] === nums[i + 1]) {
            nums[i] = nums[i] * 2
            nums[i + 1] = 0
        }
        if (nums[i] > 0) {
            const temp = nums[res];
            nums[res++] = nums[i]
            nums[i] = temp
        }
    }
    return nums
};
```
['Array', 'Two Pointers', 'Simulation', 'JavaScript']