Probability Of Knight In The Chessboard
medium
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.
Constraints
1 <= N <= 25 0 <= K <= 100 0 <= r,c <= N-1
Format
Input
A number N A number K Two numbers r and c(starting row and column position of knight in the chessboard).
Output
Check the sample output and question video.
Example
Sample Input
3
2
0
0
Sample Output
0.0625
Question Video