✅C++|| Simple Traversal  || Easy Solution
\nclass Solution {\npublic:\n    vector<int> applyOperations(vector<int>& nums) {\n        int n=nums.size();\n\n        vector<int>ans;\n        \n        for(
```\nclass Solution {\npublic:\n    vector<int> applyOperations(vector<int>& nums) {\n        int n=nums.size();\n\n        vector<int>ans;\n        \n        for(int i=0;i<n-1;i++)\n        {\n            if(nums[i]==nums[i+1])\n            {\n                nums[i]=2*nums[i];\n                \n                nums[i+1]=0;\n            }\n        }\n        \n        int cntt=0;\n        \n        for(int i=0;i<n;i++)\n        {\n            if(nums[i]==0) {\n                cntt++;\n            }\n            else {\n                ans.push_back(nums[i]);\n            }\n        }\n        while(cntt--)\n        {\n            \n            ans.push_back(0);\n        }\n        return ans;\n    }\n};\n```\n**Please upvote if it was helpful for you, thank you!**
['C']