✅C++ | ✅Brute-force approach
\nclass Solution \n{\npublic:\n    vector<int> applyOperations(vector<int>& nums) \n    {\n        int n=nums.size();\n        for(int i=0; i<n-1; i++)\n       
```\nclass Solution \n{\npublic:\n    vector<int> applyOperations(vector<int>& nums) \n    {\n        int n=nums.size();\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                nums[i+1] = 0;\n                i++;\n            }\n            \n        }\n        \n        vector<int> res(n, 0);\n        int idx=0;\n        for(int i=0; i<n; i++)\n        {\n            if(nums[i]!=0)\n            {\n                res[idx]=nums[i];\n                idx++;\n            }\n        }\n        return res;\n    }\n};\n```
['C', 'C++']