[C++] O(n) Easy Solution
\nclass Solution {\npublic:\n    vector<int> applyOperations(vector<int>& nums) {\n        for(int i=0;i<nums.size()-1;i++){\n            if(nums[i]==nums[i+1])
```\nclass Solution {\npublic:\n    vector<int> applyOperations(vector<int>& nums) {\n        for(int i=0;i<nums.size()-1;i++){\n            if(nums[i]==nums[i+1]){\n                nums[i]*=2;\n                nums[i+1]=0;\n            }\n        }\n        int place=0;\n        for(int i=0;i<nums.size();i++){\n            if(nums[i]!=0){\n                nums[place++]=nums[i];\n            }\n        }\n        for(int i=place;i<nums.size();i++){\n            nums[i]=0;\n        }\n        return nums;\n    }\n};\n\n// if you liked the solution then please upvote it so that it can reach to more people \n// If you have any doubt or want to discuss any thing related to solution please leave a comment, so that all of the viewers can discuss it\n```
['C']