C++ clean and simple sol || single pass || Time O(N) || Space O(1)
\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       
```\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]==nums[i+1])\n            {\n                int a=nums[i]*2;\n                nums[i]=nums[i+1]=0;\n                nums[j++]=a;\n            }\n            else if(nums[i])\n            {\n                int a=nums[i];\n                nums[i]=0;\n                nums[j++]=a;               \n            }\n        }\n        if(nums[nums.size()-1])\n        {\n            int a=nums[nums.size()-1];\n            nums[nums.size()-1]=0;\n            nums[j]=a; \n        }\n        return nums;\n    }\n};\n```\npls upvote the sol if u like
['C']