Jump game | Leetcode #55 | Valley peak approach
Vložit
- čas přidán 24. 04. 2020
- This video explains a very important programming interview problem which is to find if it is possible to jump indices of an array and reach the last index of array or not. We have some given constraints which are, we can't jump from 0 valued index and that we always start at index 0. I have shown the solution using backtracking intuition and a very beautiful observation using valley peak approach. I have taken easily comprehend-able examples and finally explained the code for the same. As usual, CODE LINK is given in the description below. If you find any difficulty or have any query then do COMMENT below. This problem is from Day 25 of the leetcode 30 days April coding challenge. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
CODE LINK: gist.github.com/SuryaPratapK/...
🟣 JOIN our 𝐋𝐈𝐕𝐄 𝐢𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐭𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐩𝐫𝐨𝐠𝐫𝐚𝐦 through whatsapp query: +91 8918633037
🔴 𝐂𝐡𝐞𝐜𝐤𝐨𝐮𝐭 𝐚𝐥𝐥 𝐨𝐮𝐫 𝐂𝐨𝐮𝐫𝐬𝐞𝐬: techdose.co.in/
To the world you may be just youtuber , but for us(learning geeks ";) you are the hero!! great work...
Thanks for your appreciation 😅
🙌🏻🙌🏻
I thought you would say *To the world you may be just youtuber , but for us(learning geeks ";) you are our world!* xDDD
I could not appreciate you more for your initiative of making video each day. BIG THANKS.
Whenever i am not getting clear Explaination of a problem in other channel , i jump to this channel and you solves it in such a way that anyone can understand comfortably .
You got the way of "How to Teach so that anyone can understands".
❤️
I just love the way you explain, even a novice programmer can understand the concept. Keep going.
Thanks :)
1:28
Great explanation. Glad to see you posting more videos on DS.
You are an amazing teacher sir! Your all the explanations are beautiful and clears every concept! Words cannot describe your hard work!
Thanks :)
You are great man. Such simplification really helps a lot sometimes.
Thanks :)
Dude, I made the mistake to look for a solution for this from other videos. But i must say i could only understand it by your explanation. Keep up the good work buddy.
Thanks bro :)
What an amazing teacher you are! Thanks a ton!!
Thanks bro :)
The concepts you teach are so useful that I am bound to adore your vedios.. Keep teaching us like this.. And thanks a lot man..
Welcome :)
Few more subscribers away from 10k!
Congratulations in advance!🤘🙌
This is just the beginning 💪😎
Thanks bro :)
this lecture note is one of the masterpiece
So cool explaination!
Impressed 🙌
very well explained...please keep uploading more such video's.....such explanation makes coding easier and interesting..thankyouuuuuuuuu
I can never thanks you enough as thanks is such a small word
I wish you all the best in your future journey
you are the perfect engineer(also visualize physics) and nailed the intuitions of the approach !!!!!!!!!!!!awesome
Thanks 😅
Great explanation. I solved the same question today. I have linked your video in my description.
Thanks :)
Bro, trust me this is some serious content. So far, I have been solving problems with a different mindset and you blew me up. I have seen a lot of videos on Leetcode solutions, but never seen something like this, and explanation is very clear. Thank you so much brother :)
What an Explanation. Give a big round of Applause to this sir...
Crystal clear explanation.. Thank you 🙌
wow, just wow! only thing I could add would be, exiting early after the reachable calculation by checking if you can reach the end.
Your explanation understood KG level student ,that's a great work
this solution is just a master peace and you the master 🙌
You again proof you are great, love u bro
that was a great explanation i even dont need to see the whole video for getting the idea
It would be much better if you also tell about the minimum number of steps required to move to at the end of the array
Thank you so much for all your videos! I am learning a lot!
Just one quick suggestion!
Can you please show the actual Leetcode question at the start of the video? It would be really helpful! Thanks once again!
Actually the questions are easy to understand with lower constraints. So it would be very easy to understand. I read the questions first if it has more constraints.It saves TIME in video length 😅
finally understood brother. thanks to you
To the point explanation thank you ❤
Awesome explanation!!!! You saved my day!!!
Welcome :)
reachable
Great explanation! Please create more videos on leetcode problems.
Sure 😃
bro you really explain with clarity just love it .Keep going
Very Good Explanation.
Precisely explained!! Thanks!
Welcome :)
Very nice and neat explanation!
Great explanation! Thank you!
Welcome :)
unique explanation ! Thank you sir
Welcome :)
sir your explanation is awesome it becomes so easy to understand❤️👍
Thanks :)
Brilliant explanation!
This explanation truly deserves ❤ 👍
Thanks :)
awesome, thanks for this great lesson
Welcome
Great Explanation!!!
Amazing Explanation
Thanks bhaiya
Perhaps you can break the loop if the value of reachable reaches the last index, like this. Because, if at least one value reached last index then it is possible to reach the end.
if (reachable >= n - 1)
break;
My coding skills improved a lot sir because of you❤
Keep in coding and you will improve further :)
Bro your every video has very good explanation.It is easy to understand
Thanks
its very easy and cool explanantion
please upload the min jumps problem using dynamic programming. If already uploaded please share the link
After for loop I think we still need to have another if condition to check if reachable >= array.length - 1
otherwise this code is failing for the case of [1,0,1], do correct me if m wrong
edit: I was wrong in writing this condition in for loop i < array.length - 1 , it should be i < array.length
Great explaination Sir !
💝🔥
explanation was very crystal clear, good work
Thanks :)
Amazing explanation sir :))
Very much well explained
Really amazing
I wish I have your brain man, I wasn't able to think this kind of solution... you earn a new subscriber
Thanks :) You will also be good in some time if you keep practicing.
great explanation
Nice explanation sir...thanks for the video
Welcome :)
Great explaination
Dude... just an awesome explanation.
Thanks :)
good explaination..totally understood the problem and its solution.
Nice :)
Thank you!
Again excellent explanation
Nice Explanation
I have no words to say ..lovely excellent video
Thanks
This is the solution that I can understand.
that's the best video on this topic ,sir plz upload some dynamic programming video
Sure :)
Sir you are our savior and motivation 🙏
Thanks
Surya pratap sir, jab bhi leetcode se frustrate ho jata hun aapke videos dekhta hun. Aap itna calmly koi bhi problem batate ho aur that also calms me down. Lekin kya karun sir dp hai bhi aisa topic ki itni practice ke baad bhi basic medium questions bhi rula dete hain
sir, u r really the best.. thank u so muchhhh..
Thanks Sai :)
So intutive love it
thank you sir, amazing.
we can also start from ending index of the array and keep updating the required jumps(starting from 1), and finally check for the first element if it has the required number of jumps !!
Yes correct. Both ways are same only.
omg nice presentation to give us the logical intuition thankyou....
Welcome 😄
Thanks man!
what will be time complexity of dp solution??
Nice Explanation! Have you also uploaded a video of Jump game II(minimum jumps to reach end)?
Not yet. I will make it once I start dynamic programming.
@TECH DOSE please make a video on minimum jumps to reach the end.
Wow, what a nice solution...thanks
Welcome :)
exceptional approach have you thought of this approach on your own??
hey,
How do you develop such thinking and procedure to solve such problem.
Could you guide me how i can solve such tricky questions
good explanantion
Thanks really helpful
You might just be the best!
Thanks
Loved it!
👍
thankyou so much
How do we derive such methods on the spot. I tried this with recursion. Got TLE. Then tried maintaining a list which tells me what index I have already reached out to in previous recursion step to skip it. Then also TLE. And then here it is. Done in O(n). How to achieve this sort of critical thinking. You are awesome.
Sir, Why did you use pre-increment in for loop?
how can we find max jumps to reach at end of array
Another good approach with O(1) complexity will be start searching for 0 from ending of the array, when a zero is found check next number is greater than 1,if not check if its next greater than 2. Return false if this condition fails until index 0
Thanks sir. Great explanation.
Welcome :)
can you please give me the code of that backtracking approach u mention at the beginning...?
thankuu sir you made this very easy 😃😃
Welcome 😀
I like this video.
Too good
Really a great explanation
Thanks :)
Thankyou for easy explaination
Welcome :)
How many problems you solved to get the depth of this kind of problem? No one explained like you did. Thank you
That's a really god solution