Codeforces - Bad Boy - Maximizing Distance Travelled - Matrix Problem Solved & Explained
Автор: AlgorithmicIQ
Загружено: 2021-12-27
Просмотров: 114
Описание:
Codeforces - Bad Boy - Maximizing Distance Travelled - Matrix Problem Solved & Explained
If you find this video helpful, please 'Like' & 'Subscribe'.
This is really helpful for the channel and also motivates me to do more of such good videos.
Codeforces : Bad Boy
Problem Link :
https://codeforces.com/problemset/pro...
Problem Description:
Riley is a very bad boy, but at the same time, he is a yo-yo master. So, he decided to use his yo-yo skills to annoy his friend Anton.
Anton's room can be represented as a grid with n rows and m columns. Let (i,j) denote the cell in row i and column j. Anton is currently standing at position (i,j) in his room. To annoy Anton, Riley decided to throw exactly two yo-yos in cells of the room (they can be in the same cell).
Because Anton doesn't like yo-yos thrown on the floor, he has to pick up both of them and return back to the initial position. The distance travelled by Anton is the shortest path that goes through the positions of both yo-yos and returns back to (i,j) by travelling only to adjacent by side cells. That is, if he is in cell (x,y) then he can travel to the cells (x+1,y), (x−1,y), (x,y+1) and (x,y−1) in one step (if a cell with those coordinates exists).
Riley is wondering where he should throw these two yo-yos so that the distance travelled by Anton is maximized. But because he is very busy, he asked you to tell him.
Youtube channel: / @maksrane100
https://github.com/maksrane100/leetco...
#coding #softwareengineer #Leetcode #Algorithm #DataStructure #Java #programmer #tech #software #codinglife #Preparation
#interview #programminglife #programmingisfun
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: