Dsa
Backtracking
Medium
The Restricted Knight's Path
On a 4x4 chessboard, a Knight starts at (0,0). Find the number of unique paths of exactly K moves that do not visit any cell more than once and avoid B specific 'blocked' cells. The board indices are 0 to 3.
Input:
First line: K (number of moves) and B (number of blocked cells).
Next B lines: r c (row and column of each blocked cell).
Output: Number of valid paths.
Example:
Input:
1 0
Output: 2
Explanation: From (0,0), a knight can move to (1,2) or (2,1).
Key concepts
backtrackingrecursiongrid
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now