10 Steps by Knight | Graph

Published: 26 September 2024
on channel: Aditya Verma
1,491
36

Code and explanation: https://www.patreon.com/posts/10-step...

Given a square chessboard, the initial position of Knight and position of a target. Find out the minimum steps a Knight will take to reach the target position.

Note:
The initial and the target position coordinates of Knight have been given according to 1-base indexing.



Example 1:

Input:
N=6
knightPos[ ] = {4, 5}
targetPos[ ] = {1, 1}
Output:
3

------------------------------------------------------------------------------------------
Here are some of the gears that I use almost everyday:

🖊️ : My Pen (Used in videos too): https://amzn.to/38fKSM1
👨🏻‍💻 : My Apple Macbook pro: https://amzn.to/3w8iZh6
💻 : My gaming laptop: https://amzn.to/3yjcn23
📱 : My Ipad: https://amzn.to/39yEMGS
✏️ : My Apple Pencil: https://amzn.to/3kMnKYf
🎧 : My Headphones: https://amzn.to/3kMOzM7
💺 : My Chair: https://amzn.to/385weqR
🛋 : My Table: https://amzn.to/3TyU2IU
⏰ : My Clock: https://amzn.to/3slFUV3
🙋🏻‍♀️ : My girlfriend: https://amzn.to/3M6zLDK ¯\_(ツ)_/¯

PS: While having good gears help you perform efficiently, don’t get under the impression that they will make you successful without any hard work.


Watch video 10 Steps by Knight | Graph online without registration, duration hours minute second in high quality. This video was added by user Aditya Verma 26 September 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,49 once and liked it 3 people.