Easiest beginner friendly solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> applyOperations(vector<int>& nums) {\n       \n        for(int i=0;i<nums.size()-1;i++)\n        {\n            if(nums[i]==nums[i+1])\n            {\n                nums[i]=nums[i]*2;\n                nums[i+1]=0;\n            }\n           \n        }\n        int cnt=0;\n        for(auto i:nums)\n        {\n            if(i!=0)\n            {\n                nums[cnt++]=i;\n            }\n        }\n        while(cnt<nums.size())\n        {\n            nums[cnt++]=0;\n        }\n        return nums;\n    }\n};\n```
['C++']