Simple Do what is said!!
IntuitionThe problem requires us to process adjacent elements in an array and move all zeros to the end while preserving the order of non-zero elements.Approach
# Intuition
The problem requires us to process adjacent elements in an array and move all zeros to the end while preserving the order of non-zero elements.

# Approach
1. Traverse the array once and check for adjacent equal elements.
2. If two consecutive elements are equal, double the first element and set the second to zero.
3. Perform another pass using a two-pointer approach to move all non-zero elements to the left while keeping zeros at the end.

# Complexity
- Time complexity:
  - $$O(n)$$ as we traverse the array twice.

- Space complexity:
  - $$O(1)$$ as we modify the array in place.
  
```cpp []
class Solution {
public:
    vector<int> applyOperations(vector<int>& nums) {
        int n = nums.size();

        // Step 1: Process adjacent elements
        for (int i = 0; i < n - 1; i++) {
            if (nums[i] == nums[i + 1]) {
                nums[i] *= 2;
                nums[i + 1] = 0;
            }
        }

        // Step 2: Move zeros to the end
        int j = 0; 
        for (int i = 0; i < n; i++) {
            if (nums[i] != 0) {
                swap(nums[i], nums[j]);
                j++;
            }
        }
        
        return nums;
    }
};
```
['Array', 'Two Pointers', 'Simulation', 'C++']