What was Black's last move? It's White to move. What was Black's last move, and what could have happened before that?
[FEN &quot;8/8/8/8/8/3P2P1/3P2Pk/2KR3N w - - 0 1&quot;]
There is only one black piece left, so the last move was with the king. Black's last move was obviously Kg1-h2.
The king could not have come from h3, because there is no way the white pawn could have given check from g2 (its initial position). All other squares around h2 are occupied by white pieces.

Since the black king came from g1, it was in check from the rook on d1 before the last move. Obviously the rook could not have moved to d1 from somewhere on the d file because the pawn on d2 blocks the way. So there are two possibilities how the rook could have given check:


discovered check, i.e. a white piece moved away  form e1 or f1 making space for the attack on the black king on g1
long castle


As for "1" None of the pieces currently on the board could have moved away from the 1st row (i.e. from e1 or f1) to give way for the check. However if a white knight moved from f1 to h2 giving check that would be a discovered check and the black king captured this knight on h2. Obviously this is the only option for a discovered check.

As for "2". If white castled long, that means that the white king never moved (castling rules) before, meaning the white king was always on e1. Then the question is: How did the black king get to g1? With the white king on e1, the black king could not have entered via f1 or f2. Neither it could have come via g2 (where there is still the original white pawn). 

This would mean that it came via h2. But is that possible? In order to get to h2, it would have to come from h3 (not possible because of the original never-moved pawn on g2) or from g3. 

However the black king could never have entered via g3, because the square was either i) attacked by a pawn from f2 or ii) occupied by that same pawn from f2.

That leaves as the only option, as last moves 1. Nf1-h2+ Kxh2



Going back one move further, what was the last move of black before Nf1-h2+? There are two possibilities: it could be a move by the king or it could be a move by a piece which got captured on h2 by the knight.

Let's analyze both options.

Black moved the king in move 0

If the last move was by the black king it could not have come from f1, g2, h1 (which are blocked by white pieces) and neither could it have come from f2, because there is no way the knight on h1 could have given check. That leaves only h2 as possible option. So assuming the king came from h2, where it was in check, the last white move must have been Ne3-f1+. So the moves are now 0. Ne3-f1+ Kh2-g1 1. Nf1-h2+ Kxh2. 

That is not the end of the story yet, because looking at the position before 0. Ne3-f1+ you note (basically for the same arguments as before, that the last move of black must have been Kg1-h2. On g1 the king would have been in check. This check (for the same arguments as presented before) could only have been a discovered check by the knight on e3.

So we have a situation where the black king is shuffling between g1 and h2 while the white knight is moving between f1 and e3. How can this infinite loop be broken? The only way to break this is, if there was a black piece at some point on f1, which blocked the check from the rook. This black piece on f1 got captured by the white knight when the black king was on h2.

Black moved a piece to h2 in move 0

If black must moved another piece that  got captured on h2, this piece can be a black pawn, knight, rook, or queen. It can not be a black bishop, because it could not have moved to h2 (because g3 and g1 were occupied by pieces).

Summary

Two possible solutions:

0. .... N/Q/R/pawn h2
1. Nf1xh2 Kg1xh2


or

Initial position: 

white: pawns on d2,g2,g3; Nh1; Ne3; Kc1; Rd1; 
black: Kh2; some piece on f1

-n. Nx piece f1+ Kh2g1
[any number of repeating moves with the knight shuffling between f1 and e3 and the king between g1 and h2]
-1. .... Kg1h2
 0. Ne3f1+ Kh2g1
 1. Nf1h2 Kg1xh2