Finding the valency of transition metals in coordination complexes
For the first example, you are given that there are $6\, \ce{CN}$ ligands which are -1. That means that there is a total of 6- from the ligands. We also know the overall charge of the complex is -3. That means the charge of the central metal must be +3. In the second example, we can look at the charge again. Because the $\ce{CH3-}$ has a  charge of -1, the molybdenum metals must have a +3 oxidation state each to counteract the -6 total charge from the $\ce{CH3-}$ groups. To do these problems, you should look at the charges of the ligands/metal(s) and the total charge of the complex and know that they have to match. After you figure out the oxidation state, you can find the $\mathrm d^n$ configuration by removing electrons from the $4\mathrm s$ subshell first and then 3$\mathrm d$. For example, For $\ce{Fe^{3+}}$, a neutral $\ce{Fe}$ atom has $6$ $3\mathrm d$ electrons. You first remove 2 electrons from the $4\mathrm s$ subshell and then a final one from the $3\mathrm d$ subshell. Finally, you will find that $\ce{Fe^{3+}}$ is $\mathrm{d}^5$. Again, this is based on the oxidation state of the metal.