"In the ground state of the atoms, the orbitals are filled with electrons in order of increasing energies."
Electrons enters the orbitals according to following (n+l) rules.
a) Orbitals are filled in order of increasing value of (n+l).
Thus, 4s orbital is filled before 3d orbital. For 4s orbital, (n+l)=4+0=4. For 3d orbital, (n+l)=3+2=5.
b) If two orbitals have same value of (n+l) then the orbital with lower value of n will be filled first.
Thus, 3d orbital is filled before 4p orbital. For 3d orbital, (n+l)=3+2=5. For 4p orbital, (n+l)=4+1=5. 3d orbital has lower value of n than 4p orbital.