Probability Of Knight In The Chessboard

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

1. You are given a N*N chessboard and the starting position of the knight in the chessboard.
2. The rows and columns are 0 indexed, so the top-left square is (0, 0), and the bottom-right square is (N-1, N-1).
3. You have to find the probability of knight to remain in the chessboard after exactly k number of moves.

Note -> The knight continues moving until it has made exactly K moves or has moved off the chessboard.
Input Format
A number N
A number K
Two numbers r and c(starting row and column position of knight in the chessboard).
Output Format
Check the sample output and question video.
Question Video
1 <= N <= 25
0 <= K <= 100
0 <= r,c <= N-1
Sample Input
Sample Output

  • Asked in Companies
  • Related Topics

Video Solution

Code Solution

Id Name