I Scored 100%—In the Weirdest Way Possible!
IntuitionI thought to keep a counter of number of zeros possible in the resultant array and only pushed the non zero possible elements first and then pushed the
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
I thought to keep a counter of number of zeros possible in the resultant array and only pushed the non zero possible elements first and then pushed the remaining 0's which are supposed to be at the end of the resultant array.

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    vector<int> applyOperations(vector<int>& nums) {
        int size=nums.size();
        vector<int>ans;
        int count=0;
        
        for(int i=0;i<size;i++){
            
            if(nums[i]==0)count++;

            else if(i+1<size && nums[i]==nums[i+1]){
                ans.push_back(nums[i]*2);
                i++;
                count++;
            }

            else{
                ans.push_back(nums[i]);
            }

        }        
        while(count){
            ans.push_back(0);
            count--;
        }

        return ans;
    }
};
```
['C++']