Dear Bro , please do not miss to upload daily challenge videos.
@intrepidski94172 ай бұрын
for real, this guy is carrying me with his explanations
@greatfate2 ай бұрын
another way to do 90 degree rotations if you like math is this: 90 degree clockwise: (x, y) -> (y, -x) 90 degree anticlockwise: (x, y) -> (-y, x)
@MP-ny3ep2 ай бұрын
Great explanation as always. Missed you for a while there!
@abhishaiwinston97942 ай бұрын
I think a testcase has been missed in the code,when robot starts at 0,0 ,the case hasn't been accounted for in the code,a flag can be used to check if robot reaches 0,0 again and if it's in obstacles, first time flag=0 so no problem, second time flag=1 so break, leetcode hasn't made the testcase for this event
@nirmalgurjar81812 ай бұрын
You try to -1 from directions, then you realize if you already at 0 it will turn 0 to -1 means index out of bound, so you think to add length (+4) but again it can go out of bound if goes beyond length then you handle it by taking mode (%) of the length (4) so finally it comes to d = (d - 1 + 4) % 4 ~ d = (d + 3) % 4
@prajwals82032 ай бұрын
if ele == -1: cur_dir = cur_dir + 1 if cur_dir < 3 else 0 if ele == -2: cur_dir = cur_dir - 1 if cur_dir > 0 else 3 just roll the value to 0 or max(3) when you encounter out of bound
@vidhishah91542 ай бұрын
Thank you for adding video solution.
@malvado82672 ай бұрын
instead of (d-1)%4 , use (d+3)%4
@chiragverma58392 ай бұрын
why?
@54-nileshparab962 ай бұрын
@@chiragverma5839 bcoz d=-1 might happen which is out of bound
@nirmalgurjar81812 ай бұрын
You try to -1 from directions, then you realize if you already at 0 it will turn 0 to -1 means index out of bound, so you think to add + 4 but again it can go out of bound if goes beyond length then you handle it by taking mode(%) so finally it comes to d = (d - 1 + 4) % 4 ~ d = (d + 3) % 4
@techy_ms-e2m2 ай бұрын
Thinks that java user needs
@ParodyCSEDept2 ай бұрын
A proper medium problem
@kcprxkln2 ай бұрын
it it possible to implement obstacle detection just based on the movement? something like if the obstacle is placed between old and new x/y when the second coord is the same?
@AVIS_112 ай бұрын
Genuine question why can we directly check from the list given why we are using hash set
@mohamedasifar2 ай бұрын
This problem is nightmare for me 😶
@tharunkumar50952 ай бұрын
Question says, there might be obstacle at (0,0) So, what does that mean?? Robot can move on obstracle as well??
@rafik19682 ай бұрын
yes he can move ... but if the instructions lead him again to (0,0) it won't access it and will stop one step before.Don't overthink about this edge case .it is not important in the logic .Try to use Hashmap and follow the instructions of the problem set...no tricks just the implementation
@tharunkumar50952 ай бұрын
@@rafik1968 Okay Thank you :-)
@badgamertreek66982 ай бұрын
Any neetcode discounts coming up?
@Apoorv24312 ай бұрын
wow i mean wow what an explanation
@tariqelamin58472 ай бұрын
I dont understand how the model work in this problem
@VinayKumar-xs6el2 ай бұрын
GOAT
@prajwals82032 ай бұрын
took me a long time to realize moving north is not similar to moving up one row