class Solution {
  public:
    void pushZerosToEnd(vector<int>& a) 
    {
    
        int n = a.size();

        int i = 0;
        int j = 0;

        while (j < n)
        {
            if (a[j] != 0) // means non zero element
            {
                swap(a[i], a[j]);
                i = i + 1;
                j = j + 1;
            }
            else
            {
                j = j + 1; // Element is zero move only 'j' pointer
            }
        }

        return;
        
    }
};