How can I use DFS for this problem ?

# Can I use DFS approach for this question?

no. Bcoz u need to go greedy , so u need to move level by level. So BFS approach is the right approach

Just to find whether Knight can move to the destination or not we can use DFS approach, but to find the **minimum** number of steps for the knight to move, we have to use BFS.

why so ? can you plz explain ! I was calling dfs in all 8 directions for each cell that I reach and was then finding the minimum out of all 8 and then returning. My ans is partially acceptedâ€¦so can you plz tell this concept. Thank you