Could you make a live coding session for any of the leetcode daily challenge question? Want to know how you arrive at the solution and code it. That wud be helpful for my coding interviews.
I think I understand why we take "NOT NORTH as a condition" ---> Say for example you're starting your journey in Bangalore [we'll take bangalore as the origin: (0,0)]... You want to travel all of India and then return back home to Bangalore. So let's suppose you drove to north india, then you took a right travelled to east india and now you're facing in the east direction (eg. you're in east india and you're facing towards japan). Now to come back to bangalore you will have to travel towards your right side. WHEN YOU ARE FACING EAST: if you travel straight ahead you will be moving towards Japan If you travel left, you will be travelling towards Nepal If you travel backwards, you will be travelling towards Gujarat but if you travel towards right then you'll be coming back to bangalore so all in all it means if you started from origin while facing northwards and you want to come back to origin you can never do that if you still keep facing north, you'll have to turn in some way to come back to origin AND if you turn that implies your direction is changing. BUT let's suppose you never moved from Bangalore, you just stood at one place and kept changing the side you're facing In this case your coordinates would be constant at (0,0) I hope this helps you understand. If not, let me know I'll try and elaborate? :)
The current direction of the robot's face is North so whenever you encounter any left or right in the instruction string you've to change the direction (which is done in the else part of the loop)otherwise keep on moving in the direction in which you're . Now the co-ordinates of x and y would depend on what direction you're moving forward as we have already updated the most recent direction so the co-ordinates would be updated accordingly.
your way to write code is best☺
Thanks Shalini 🙃
Thanks a lot for the great explanation with visualization. I see very less in other channels. Keep it up!
Welcome, glad it was helpful :)
Could you make a live coding session for any of the leetcode daily challenge question? Want to know how you arrive at the solution and code it. That wud be helpful for my coding interviews.
Sure Rohith, just don't have that much bandwidth most of the time on weekdays . I will plan this for weekend. :)
why exactly is any direction other than north, is going to return false
I think I understand why we take "NOT NORTH as a condition" --->
Say for example you're starting your journey in Bangalore [we'll take bangalore as the origin: (0,0)]... You want to travel all of India and then return back home to Bangalore.
So let's suppose you drove to north india, then you took a right travelled to east india and now you're facing in the east direction (eg. you're in east india and you're facing towards japan). Now to come back to bangalore you will have to travel towards your right side.
WHEN YOU ARE FACING EAST:
if you travel straight ahead you will be moving towards Japan
If you travel left, you will be travelling towards Nepal
If you travel backwards, you will be travelling towards Gujarat
but if you travel towards right then you'll be coming back to bangalore
so all in all it means if you started from origin while facing northwards and you want to come back to origin you can never do that if you still keep facing north, you'll have to turn in some way to come back to origin AND if you turn that implies your direction is changing.
BUT let's suppose you never moved from Bangalore, you just stood at one place and kept changing the side you're facing In this case your coordinates would be constant at (0,0)
I hope this helps you understand. If not, let me know I'll try and elaborate? :)
very intutive! thanks
Welcome 😄
Thanks sister, for this best explanation ❤
welcome Rajender, glad it was helpful :)
Doing great job, Just your voice is bit low or may be that is my speaker issue. Please check once :) Thank you
Welcome, sure Ankit, I will look into it :)
Great Explanation
Thank you :) glad it was helpful
You are a fan of Lexi Hensler, right? btw awesome vedio😃
😂 kind of whole amp squads 😛
Finally 😎, waiting since morning
🥺🥺😊
loved your solution...keep up the good work✨✨✨
Thank you Anurag, glad it was helpful :)
Thanks a lot for this great tutorial !
Welcome, glad it was helpful :)
nice explanation
thank you :)
Thanks for making this video
Welcome, glad it was helpful :)
Great explanation :)
Thank you :) glad it was helpful
Waiting for this 🎉💜
😄🥺🥺
from striver sheet i am unable to solve 95% solutions without seeing the solution, what shall i do ??
Thanks di :)
Welcome, glad it was helpful :)
Consistency Op 🔥
Thank you :)
How to get internship at big tech companies 😭. Plz do one video plz 🙏
Sure Surya :)
this is good
Thank you :)
why incoming will always be L if not g but it can also be R
Hi Sangam, I think u are getting confused in ternary operator, it is like incomming == L? Sth happens : sth happens. (It is like if else)
but di aapne current direction ko "N" define kia hai... so aap S,E,W kese use kr paa rahe ho. S,E,W pehle kai define nhi kie
The current direction of the robot's face is North so whenever you encounter any left or right in the instruction string you've to change the direction (which is done in the else part of the loop)otherwise keep on moving in the direction in which you're .
Now the co-ordinates of x and y would depend on what direction you're moving forward as we have already updated the most recent direction so the co-ordinates would be updated accordingly.
Neelesh, please refer Harsh's comment, if you still have any doubts, let me know :)
@@harshtyagi700 thanks Harsh for helping out :)
hlo di i m in 4th sem and i start leetcode daily challange from 1st jan and doing one coding question daily it is enough ?
Prashant, I would suggest practice more interview specific questions either from leetcode /interviewbit/ codestudio/gfg
@@AyushiSharmaDSA then how to manage time i have to cover subjects also
@@prashantpundir7448 just keep few hours of day for coding
@@AyushiSharmaDSA i recently see your video on coding ninja
OP Solution
Thank you Saurabh :)
Nice explanation Thank You.
subscriber++;
Welcome, glad it was helpful :)
Saviour🙌😟❤️
😊😊🥺
Done !!!
Awsm :)
This approach fails if instruction is only GG
No bro