EASY SOLUTION IN  C++
```\nclass Solution {\npublic:\n    vector applyOperations(vector& nums) {\n       \n        int j =0;\n        for(int i =0;i<nums.size()-1;i++)\n        {\n  
```\nclass Solution {\npublic:\n    vector<int> applyOperations(vector<int>& nums) {\n       \n        int j =0;\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            else \n            {\n                nums[i];\n            }\n        }\n        for(int i =0;i<nums.size();i++)\n        {\n                \n            if( i==j && nums[i]!=0)\n         {\n             j++;\n             continue;\n         }\n         if (nums[i]!=0)\n         {\n             nums[j]=nums[i];\n             nums[i]=0;\n             j++;\n         }\n        \n     }\n    \n        return nums;\n    }\n};
[]