Electronic configuration follows the Aufbau principle, Hund's rule, and the Pauli exclusion principle. The order of filling orbitals is generally 1s, 2s, 2p, 3s, 3p, 4s, 3d, 4p, etc. For transition metals, the $n$s orbital is filled before the $(n-1)d$ orbital. However, there are some exceptions to achieve more stable half-filled or fully-filled $d$ or $f$ subshells (e.g., Cr and Cu).