11 Steps by Knight | Graph | Code

Опубликовано: 30 Сентябрь 2024
на канале: Aditya Verma
975
30

Code and explanation: https://www.patreon.com/posts/11-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.

Link: https://www.geeksforgeeks.org/problem...


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.


Смотрите видео 11 Steps by Knight | Graph | Code онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Aditya Verma 30 Сентябрь 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 97 раз и оно понравилось 3 людям.