Easy C++ Solution || Beats 100% 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
![{C9F1CB38-1318-42DA-ADE7-FEC762775858}.png](https://assets.leetcode.com/users/images/03d40d96-29b6-4ce6-8f2b-03dc1eecbf89_1740835406.684324.png)

# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

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

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

# Code
```cpp []
class Solution {
public:
    vector<int> applyOperations(vector<int>& nums) {
        for(int i=0;i<nums.size()-1;i++){
            if(nums[i]==nums[i+1]){
                nums[i]*=2;
                nums[i+1]=0;
            }
        }
        int curr=0;
        for(int i=0;i<nums.size();i++){
            if(nums[i]!=0){
                swap(nums[i],nums[curr]);
                curr++;
            }
        }
        return nums;
    }
};
```
['C++']