What does this question wants is very unclear. Where does the knight have to reach?
Funky Chess Board : Problem not clear
see the chess board is not placable positions( where knights can be kept) 1 denotes yes knight can be placed , 0 denotes the knight is not placable, invalid position
so the question asks u the maximum no of positions the knight can travel starting from 0,0
u have a dfs call for all 8 possible moves from each cell
Minimize the no of un-visited cells means that knight is able to visit the maximum no of valid positions in the board.
eg:
3
1 1 1
1 1 1
1 1 1
all board positions are 1
so maximum visible cells are 9
now i start the knight from 0,0 have all 8 dfs call at each position
getting to see that knight can move on 8 valid cells at max
hence 9-8 == 1 is the answer
1 cell is left un-visited