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.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Check if the end of the Array can be reached from a given position
- Count the values greater than X in the modified array
- Maximum number of nodes which can be reached from each node in a graph.
- The Knight's tour problem | Backtracking-1
- Warnsdorff's algorithm for Knight’s tour problem
- Minimum steps to reach target by a Knight | Set 2
- 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
- Sum of all the prime numbers with the maximum position of set bit ≤ D
- Minimum moves required to change position with the given operation
- Number of ways in which an item returns back to its initial position in N swaps in array of size K
- 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
- Position of Elements which are equal to sum of all Preceding elements
- Count of quadruplets with given sum | Set 3
- Count of quadruplets with given Sum
- Count no. of ordered subsets having a particular XOR value
- Count of even and odd set bit with array element after XOR with K
- Count of columns with odd number of 1s
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.