If you think ideal gas, you also think that the molecules do no occupy any volume of the container and therefore no collision between molecules is possible. Now we consider finite size of molecules (for real gases) so that we can talk about the collisions between molecules.
The average path (distance) traveled by a molecule between collisions is called mean free path. Let's consider a molecule moves with all other molecules at rest. When the molecule collies with another molecule, the distance between their centres is \(r_1 + r_2\) where \(r_1\) and \(r_2\) are the radii of the colliding molecules.
If you consider all molecules are identical having the same radius \(r\), the distance between the centres of the colliding molecules is \(2r\). Here we suppose that all molecules have the same radius \(r\). The moving molecule collides with another molecule whose centre lies within the distance \(d = 2r\) as the molecule moves. In time \(dt\) the molecule moves with speed \(v\) and travels a distance of \(vdt\), and it collides with the molecules whose centres lie in the cylindrical volume of \(\pi d^2 vdt\) where \(d = 2r\).
We know that the number density is the number of molecules per unit volume, that is \(N/V\) where \(N\) is the total number of molecules and \(V\) is the total volume of the container. So, the number of molecules in the cylindrical volume is \(\pi d^2 vdt (N/V)\). Now the mean free path is the distance traveled divided by the number of collisions. Note that the number of collisions is the same as the number of molecules (except the moving molecule) inside the cylindrical area we considered. Therefore, the mean free path is
\[\lambda =\frac{vdtV}{\pi {{d}^{2}}vdtN}=\frac{V}{\pi {{d}^{2}}N} \tag{1} \label{1}\]
In real situation all molecules move randomly not only one molecule and therefore the correct expression of the above equation is
\[\lambda = \frac{V}{{\sqrt {2{\kern 1pt} } \pi {d^2}N}} \tag{2} \label{2}\]
In terms of ideal gas equation $pV = NkT$,
\[\lambda = \frac{kT}{{\sqrt {2{\kern 1pt} } \pi {d^2}p}} \tag{3} \label{3}\]
You can find the mean free time if you divide \(\lambda\) by \(v\).