A more systematic way I learned in my gchm class is here:
Suppose the two elements are X and Y
Total valence e: 10
so put X-Y
Now, # available: 8 (bc you used 2 to form a single bond between the two)
# required to fill the octet: 12 (6/ element)
This means that you need 4 extra electrons than available (12-8=4), so put 2 extra bonds, which results in a triple bond between X and Y.
These are all the bonds you will have, and you will put one extra pair of electrons on each one to use all the 10 electrons.
Wish I had paper and pen to explain this, but oh well.
Hope this helps!!