Explain the structure of HNC (Hydrogen Isocyanide)
In such type of questions, we can't directly determine Oxidation state by the normal algebra method.

First you have to draw the structure.

1.In a covalent bond, the more electronegative element gets a contribution of -1and the other element gets a contribution of +1 charge(valid for both sigma and pi bonds. Treats double double bond as two single bonds and triple bonds as three singles bonds).


Bonds between same element have contribution 0 to each element.
In a coordinate bond, if the bond is directed from less electronegative element to more electrononegative element, the more elecronegative element gets a contribution of -2 and the less electrononegative element gets a contribution of +2.


4.in case the coordinate bond is directed from more electrononegative to less elecronegative elements, the contribution is 0 to each element.

5.To these 4 steps for each and every bond. The value of Oxidation state of an element is sum of all contributions due to all other elements/bonds.

In your question, due to C-H bond, carbon gets -1 and hydrogen +1. Due to the triple bond between C and N, N gets -3 and C gets +3.

Summing all, 

Oxidation state of hydrogen is +1

Oxidation state of carbon is -1+3=+2

And oxidation state of nitrogen is -3