In order to write the electronic configuration of an atom correctly, follow the (n+l) rule. According to which, the orbital with the least value of (n+l) will be filled first with electrons.
But there are exception to this rule. In the electronic configuration of Cr(24) and Cu(29) (image below), the point about extra stability of fully-filled and half-filled configuration takes precedence.