Given a chessboard of size 8 x 8 and the current position of Mirandote. All the rules of this chess game are same but the knight is modified, we call new knight as “Mirandote”. The moves of Mirandote is given by blue color where its current position is denoted by red color in the following image :
The task is to find how many possible positions exist in Chessboard that can be reached by Mirandote in exactly S steps.
Input: row = 4, col = 4, steps = 1
All the 12 moves denoted by the following image by blue color :
Input: row = 4, col = 4, steps = 2
We can observe that all the possible position with respect to current position can be written in the form of row and column. This thing is illustrated by the following image :
We can call a function recursively for each possible position and count all the possible position.
Below is the required implementation to find the positions:
Time complexity of above algorithm is O(), where S is the number of steps.
- Maximum number of nodes which can be reached from each node in a graph.
- The Knight's tour problem | Backtracking-1
- Minimum steps to reach target by a Knight | Set 2
- Warnsdorff's algorithm for Knight’s tour problem
- Number of blocks in a chessboard a knight can move to in exactly k moves
- Find the modified array after performing k operations of given type
- Position of n among the numbers made of 2, 3, 5 & 7
- Minimum moves required to change position with the given operation
- Count numbers < = N whose difference with the count of primes upto them is > = K
- Microsoft Interview experience for full time position of software engineer at Microsoft Ireland Research
- Count of quadruplets with given Sum
- Count number of pairs (i, j) such that arr[i] * arr[j] > arr[i] + arr[j]
- Count no. of ordered subsets having a particular XOR value
- Count all possible paths between two vertices
- Count unique subsequences of length K
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.