Referring to your pictures, you have:
1. in N2O3, attributing all the bond electrons between N and O to the oxygen, one N (the one at left) is left with 1 lone pair (that you didn't draw) + 1 electron from the bond with the other N, so 3 electrons as total --> oxidation number = + 2 (5-3); the other N atom is left only with the electron that comes from the bond with the previous N, so ox. number = + 4 (5-1). The average is +3: [(+2) + (+4)]/2 = +3 which is nitrogen's ox. numb. in that compound.
2. in N2O5, after attributing the bond electrons to the most electronegative element (oxygen), both N atoms are left with no electrons, so their ox. numb. = +5 (5-0).