I’m not able to understand this question please help me
I'm not able to understand this question please help me
see the chess board is not placable positions( where nights 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 travell starting from 0,0
u have a dfs call for all 8 possible moves from each cell
Minimize the no of unvisited 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 unvisited