Minimum jumps to reach end of array (Dynamic Programming)

Поделиться
HTML-код
  • Опубликовано: 9 окт 2024
  • We find minimum jumps to reach end of array. This is a dynamic programming problem.

Комментарии • 176

  • @vibhashreems526
    @vibhashreems526 3 года назад +39

    Watched everybody's explanation whole day I searched but I finally understood yours

  • @AlokGuptakumar
    @AlokGuptakumar 6 лет назад +32

    u really patiently explain all solutions...thanks

  • @siddharthkhandelwal933
    @siddharthkhandelwal933 5 лет назад +11

    U actually teach very well.and that clearly explains that u have the feel of DP

  • @natesh1
    @natesh1 6 лет назад +54

    In ur videos pls consider to mention the time and space complexity also. Helps greatly to judge the method.

  • @mdalishanali3909
    @mdalishanali3909 2 года назад

    I was struggling a lot with this problem. Thank you for explaining so thoroughly.It is helpful after 100 years also..

  • @rajashribanerjee6934
    @rajashribanerjee6934 2 года назад +1

    I was struggling a lot with this problem. Thank you for explaining so thoroughly.

  • @nickharalampopoulos
    @nickharalampopoulos 4 года назад +1

    This is the most thorough explanation I have seen. Thank you.

  • @vaibhavimandloi6953
    @vaibhavimandloi6953 2 года назад

    I was stucked at this problem for a whole day but now I got it completely .Thankyou!!

  • @historybrow9850
    @historybrow9850 4 года назад +2

    i am always so happy, whenever i search for a problem and u have a solution, u give the best explanations

  • @kdroadie
    @kdroadie 5 лет назад +1

    my dynamic programming grip is now awesome,,thanks to u sir

  • @devanshsharma5704
    @devanshsharma5704 5 лет назад

    The best explanation for the problem , huge respect sir

  • @shubhadityamaljonia6613
    @shubhadityamaljonia6613 3 года назад +1

    Really a good explanatory video but it would be more better if you put a link of the code explained in the video, as it would be difficult for us to find code of such beautifully explained algorithm. Thanks Again...

  • @rajitsrajan2644
    @rajitsrajan2644 3 года назад

    Your channel is great. Please continue uploading videos. Your presentation and way of teaching is amazing. Keep up the good work.

  • @captainamerica2992
    @captainamerica2992 3 года назад

    i watched a 1000 videos on this question and this video just explained it so easily , thanks

  • @mahakgupta5165
    @mahakgupta5165 5 лет назад

    This same question was asked in Goldman Sachs internship written paper.
    At that i was unable to solve ,but now i can.
    Thank you.

  • @bijayamanandhar3890
    @bijayamanandhar3890 2 года назад

    I want to work as a data scientist or machine learning engineer, and preparing for job interview. Your videos help me a lot, however 'Graph' is new to me.

  • @ashishupadhyay6881
    @ashishupadhyay6881 4 года назад +3

    A few changes to make it O(n) instead of O(n^2) :)
    jump(vector &a) {
    int n=a.size();
    if(n

    • @subhashmallick
      @subhashmallick 3 года назад

      Also you could have done early return whenever dp[j] is filled where j has reached n-1.

  • @ashishjangir88
    @ashishjangir88 3 года назад +1

    Another Solution in just O(n) and Easy to Understand:
    int minJumps(int arr[], int n){
    // Your code here
    if(arr[0] == 0)
    return -1;
    else if(n == 1)
    return 0;
    int dest = 0, pos = 0, jumps = 0;
    for(int i=0; i

    • @Rafi-nc3nw
      @Rafi-nc3nw 2 года назад

      Thank you very much!!! Such a mind blowing and easy concept.

  • @vikasmishra1190
    @vikasmishra1190 4 года назад +1

    Jump= -1;
    Sum=0;
    While (sum=n){
    jump++;
    }
    cout

  • @AllTypeShorts..
    @AllTypeShorts.. 3 года назад

    Sir, I was struggling for understanding this problem. I even tried 3-4 video lectures of different people but still I can't get it. But the way you explained this problem hit directly in my brain and finally I find it very easy. Many Many thanks for your explanation and efforts. God bless you always.

  • @ragingpahadi
    @ragingpahadi 4 года назад

    Your explanation are detailed ad very very easy to understand keep up the good work buddy !

  • @shivamshrivastava5019
    @shivamshrivastava5019 4 года назад +1

    sir you expalain too good ...i was searching for the channel like yours for two week, finally i got your channel ....SUBSCRIBED SIR

  • @satanlucifer4437
    @satanlucifer4437 3 года назад

    Something about your explanation really clicked we me. Since we haven't learned the technique of using infinity in my class, I instead used None and added a couple if statements :)

  • @alpeshnakarani
    @alpeshnakarani 5 лет назад +1

    Super Detailed explanation. Really helpful.

  • @cedong6412
    @cedong6412 6 лет назад

    Really love your video for this topic! I think you are the only one who teaches step by step and I totally understand DP solution for this problem, thanks for your efforts and wish all the best:)

  • @pranybany
    @pranybany 4 года назад

    Thanks Vivekanand Khyade you rock as always.

  • @adarshgupta4382
    @adarshgupta4382 6 лет назад

    You are indeed the best teacher for algorithm .

  • @aaokhelen
    @aaokhelen 3 года назад +2

    greatest tutorial i've ever seen. Keep it up

  • @anirudhdevpura2798
    @anirudhdevpura2798 4 года назад

    very good and thorough explanantion. Keep it up sir. But just try to explain complete code also along with explanation

  • @hirakmondal6174
    @hirakmondal6174 3 года назад +2

    Great video, but one point to note is that it will fail for some corner cases like--> arr[]={0,1,1,1,1}. This doesn't has any solution

  • @bhanuarora4504
    @bhanuarora4504 3 года назад

    Really nice explaination for a beginner like me,thanks sir

  • @adityapandey9758
    @adityapandey9758 3 года назад +2

    sir aapka code itna simple aur chota tha...aur mene code likhne me 2 din laga diya phir bhi solution nahi nikala....phir aapka code dekha...aur bht hasi aayi itne simple code ke liye me najane kya kya kr raha tha😂😂

  • @keerthanamahalingam474
    @keerthanamahalingam474 3 года назад

    Hats off to your explanation sir great video sir

  • @raj-nq8ke
    @raj-nq8ke 3 года назад

    As usual always the best explanation.

  • @anmolkumarshah
    @anmolkumarshah 3 года назад

    very good explanation .. really liked your way of teaching
    i hit the bell icon now

  • @laraibanwar1618
    @laraibanwar1618 4 года назад

    Sir please put up more videos on dp
    It was very helpful.
    Ur way of explanation is very good
    I was able to solve codeforces problems related to dp
    Plz sir

  • @yidonghuang3280
    @yidonghuang3280 4 года назад +1

    He is a amazing teacher(from a leaner in China)

    • @Aryansingh-fk7hy
      @Aryansingh-fk7hy 3 года назад

      CCP has blocked RUclips in china!,you use VPN or live in india istead?

    • @yidonghuang3280
      @yidonghuang3280 3 года назад

      @@Aryansingh-fk7hy I'm living US

    • @Aryansingh-fk7hy
      @Aryansingh-fk7hy 3 года назад

      @@yidonghuang3280 fortunate you are!!.

  • @EternalDharma01
    @EternalDharma01 6 лет назад +1

    One minute was enough to make a comment about the video. Loved it.

  • @therohanjaiswal
    @therohanjaiswal 3 года назад

    the best explanation for this problem

  • @vikashkumarchaurasia1299
    @vikashkumarchaurasia1299 5 лет назад

    best explaination i have ever seen for this problem , thanks a lot !!!

  • @veganengineer2019
    @veganengineer2019 4 года назад

    excellent explanation. very thorough

  • @sajeelkhan4500
    @sajeelkhan4500 3 года назад

    brilliantly explained sir

  • @sarfarazalam6077
    @sarfarazalam6077 4 года назад +1

    You made my day!! Thank you great explanation. Video answered all my doubts. It would be more useful , if you could give intuition to problem.

  • @DSA_Coding
    @DSA_Coding 3 года назад

    I really enjoyed your way of teaching ,

  • @ayaramzy6815
    @ayaramzy6815 3 года назад

    I love yr videos u are the best ... please explain palindrome partitioning

  • @niveditakatakam
    @niveditakatakam 6 лет назад

    To reduce the number of iterations, I think we can directly start index j from jump_path_arr[i-1] and check if i is reachable and increment j from there.

  • @manasranjan4
    @manasranjan4 3 года назад

    Good Explanation. Kudos Really you appreciate

  • @hrithikjaiswal4040
    @hrithikjaiswal4040 3 года назад

    Great One ! Excellent dry run..

  • @aditikhandelwal135
    @aditikhandelwal135 3 года назад

    Amazing!! after so many videos this is best

  • @ashwanisharma8903
    @ashwanisharma8903 2 года назад

    Thanks sir. You just made complex algo like kids game. Thanks a ton.

  • @ranjanrohit64
    @ranjanrohit64 6 лет назад

    THANKS FOR SUCH A BEAUTIFUL VIDEO SIR. I GOT IT FULLY...A BIG THANKS

  • @shyamnwade
    @shyamnwade 5 лет назад

    Excellent way of explaining algorithm

  • @tan5553
    @tan5553 5 лет назад

    Could you please xplain the problems in cracking coding interview book... The way you xplain is easily understandable.

  • @RANJANJHA95
    @RANJANJHA95 6 лет назад +1

    Please help if you can design some optimised algorithm for below problem statement.
    You have synonyms for words stored in dictionary/map like
    HashMap synonyms = new HashMap()
    synonyms.put(“tree”, “tree1")
    synonyms.put(“far tree”, “tree2")
    You have to replace the word present in input string with the value corresponding to the key present in the map.
    Input: I saw a far tree near the old tree
    Output: I saw a tree2 near the old tree1

  • @yashnistane6728
    @yashnistane6728 3 года назад

    Very beautifully explained!!!

  • @ankitsinha9019
    @ankitsinha9019 4 года назад

    Awesome explanation...sir

  • @narayananrenganathan765
    @narayananrenganathan765 5 лет назад

    Please add videos for different sorting algorithms. Thanks in Advance. Great work. Keep going !!

  • @namanvijay3514
    @namanvijay3514 3 года назад

    Best explanation 👍

  • @JustSkillGG
    @JustSkillGG 5 лет назад

    I would add a "break;" command after the if {..}
    Excelent work.. Thank you sir! This channel will definetely blow up someday

  • @sushmitamandal942
    @sushmitamandal942 3 года назад +1

    amazing explanation

  • @mybabyharshu
    @mybabyharshu 5 лет назад

    great explained .. when you assigning jump path array ?

  • @yyiiggaall
    @yyiiggaall 4 года назад +1

    Nice algorithm, but you can improve the run-time by putting a break; after the first updating of any element. This because its impossible to improve the number of the jumps by using an index that com after it.

    • @TheAdityaVerma
      @TheAdityaVerma 4 года назад

      I am a SDE at Flipkart have a look at my DP playlist that actually landed me a great package job: ruclips.net/video/nqowUJzG-iM/видео.html

  • @lilzjay9732
    @lilzjay9732 5 лет назад +15

    respect from China!

    • @babbarutkarsh7770
      @babbarutkarsh7770 4 года назад +1

      We thought your firewalls were difficult to be penetrated.

  • @utsavkaranjit2911
    @utsavkaranjit2911 3 года назад

    Amazing Explanation to the solution. But looks like this solution is too slow. How can we improve the time complexity?

  • @lueizack6639
    @lueizack6639 3 года назад

    superb explanation

  • @ishan_kumar
    @ishan_kumar 5 лет назад +7

    One more check is required in if condition. Awesome explanation though. Kudos!
    if( i

  • @dhirendrakumar4619
    @dhirendrakumar4619 5 лет назад

    Very Good explanation Sir thanks

  • @VIJENDRASINGH-zg2lp
    @VIJENDRASINGH-zg2lp 3 года назад

    Best explanation. Thank you!

  • @coder_ishwar_kumar
    @coder_ishwar_kumar 2 года назад

    Can u pls solve this in O(N) TC ans O(1)SC .. thx fr the great video ... even though i know the solution i always come to ur channel to watch the solution bcoz ur explanations are great..

  • @BhaiyaDesi
    @BhaiyaDesi 5 лет назад

    The algorithm could fail in many uncommon scenarios like {1, 0, 3, 5}. Algorithm explained is pretty straightforward , but it lacks accommodating few exceptional cases.

  • @surya0072
    @surya0072 6 лет назад

    superb !! any real time situations where we use this logic ?

  • @riitviksharma5932
    @riitviksharma5932 2 года назад

    Best explanation

  • @anubhavnema613
    @anubhavnema613 4 года назад

    Too good explanation

  • @rahulchaubey8988
    @rahulchaubey8988 4 года назад

    Nicely explained...

  • @AshishKumar-to7gy
    @AshishKumar-to7gy 4 года назад

    nice explanation..

  • @priyankajhamb7061
    @priyankajhamb7061 2 года назад

    Nice explanation

  • @sourabhahuja
    @sourabhahuja 6 лет назад

    Awesome Vivek!!! Great Videos. Thank you very much :-)

  • @PrafulPrasad
    @PrafulPrasad 4 года назад

    Super awesome explanation. The answer to the problem is explained on geeksforgeeks.org but I never understood it even after trying to debug the code multiple time. This is a lengthy video but it was well worth my time understood it in an instant. The only problem is its not the most optimal solution even in DP :(

  • @harshpanwar1550
    @harshpanwar1550 3 года назад

    Thank u so much sir!!! This really helped a lot...

  • @priyanshukhullar5836
    @priyanshukhullar5836 4 года назад

    Jordaar Uncle :)

  • @piyushrathi9771
    @piyushrathi9771 3 года назад

    Can you explain how the algorithm will take care of the array [0,1,1,1,1]???

  • @anjaliphogat9817
    @anjaliphogat9817 6 лет назад

    Minimum sum partition(Given an array, the task is to divide it into two sets S1 and S2 such that the absolute difference between their sums is minimum.) video on this topic..
    please upload asap...thanks in advance:)

  • @svdfxd
    @svdfxd 5 лет назад

    Another excellent video.

  • @teetanrobotics5363
    @teetanrobotics5363 5 лет назад +1

    Can you please order the dynamic programming playlist ?

  • @abcd1235911
    @abcd1235911 5 лет назад +1

    This is an O(n^2) solution. Do you have O(n) solution?

  • @RahulKumar-lb9nk
    @RahulKumar-lb9nk 6 лет назад

    Your videos are very interesting .. It would be great if could segregate your content based on context and post as modules

  • @bharadwajachepuri968
    @bharadwajachepuri968 6 лет назад

    Hi Sir can you please explain the grid formation of Egg Dropping Problem and longest ariyhmetic sequence in DP

  • @ANANDJULU
    @ANANDJULU 5 лет назад

    awesome explanation!

  • @laveenajethani9734
    @laveenajethani9734 3 года назад

    nice explaination

  • @sukritkapil9816
    @sukritkapil9816 4 года назад

    thanks for detailed explanation!

  • @ΑντρέαςΣωτηρίου-π8γ

    You are a boss keep the good work

  • @anujdeep3796
    @anujdeep3796 5 лет назад

    thank you sir for the wonderful video.

  • @tarungopal3065
    @tarungopal3065 4 года назад

    Can you please make a video on "
    Count of subarrays whose sum is a perfect square".

  • @ir0nt0ad
    @ir0nt0ad 6 лет назад

    thanks a lot! could you please do Kruskal's MST at some point?

  • @yashimisra2518
    @yashimisra2518 3 года назад +1

    how to initialize entire array to infinity?

    • @utkarshsingh3874
      @utkarshsingh3874 3 года назад +1

      you can run a loop from 0 to n-1 and intialize array with INT_MAX in c++ or you can use vector ---------> vector (n,INT_MAX)

    • @yashimisra2518
      @yashimisra2518 3 года назад

      @@utkarshsingh3874 thanks.I knew the loop one, i was wondering if there was a shortcut.This helped :)

  • @akshatgupta2607
    @akshatgupta2607 3 года назад

    What a way to explain !!

  • @cskwillreturn2473
    @cskwillreturn2473 6 лет назад +2

    Man! This is like Dijkstra. Also I dont like 'j' going back to '0' everytime you increase 'i'.

    • @well....7751
      @well....7751 3 года назад +1

      include break after the min calculation so that it immediately terminate not entirely going through all the indexes

  • @madhusudanankaskar3989
    @madhusudanankaskar3989 5 лет назад

    Sir kindly make a video on Buying and selling of shares using k transactions. I am not able to understand the concept.

  • @AbhishekKumar-wc2he
    @AbhishekKumar-wc2he 5 лет назад

    sir please make some videos on question asked on heaps

  • @barathnatarajan8566
    @barathnatarajan8566 3 года назад

    YOu are the BEST .