DP 12. Minimum/Maximum Falling Path Sum | Variable Starting and Ending Points | DP on Grids

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ย. 2024

ความคิดเห็น • 1.1K

  • @takeUforward
    @takeUforward  2 ปีที่แล้ว +206

    I need your support, and you can do that by giving me a like, and commenting "understood" if I was able to explain you.
    Keeping a like target of 500 ❤️✌🏼

    • @willturner3440
      @willturner3440 2 ปีที่แล้ว +2

      Crosssed 1k 🙌

    • @anonymousvoid6356
      @anonymousvoid6356 2 ปีที่แล้ว +1

      5 lakh

    • @nikhilsaharan
      @nikhilsaharan 2 ปีที่แล้ว +1

      @@anonymousvoid6356 😂

    • @LBK3
      @LBK3 ปีที่แล้ว +3

      Believe me sir these lectures are sooo valuable that in upcoming days your like target will be crossing 100 times of what you expected...thank you so much ❤

    • @sukhpreetsingh5200
      @sukhpreetsingh5200 ปีที่แล้ว +1

      Understood and awesome these type of videos must deserve more than million likes Just awesome.

  • @RupamSasmalYt
    @RupamSasmalYt ปีที่แล้ว +122

    I couldn't believe that I have solved this question without watching this tutorial, It's all about striver's magic 🔥🔥 You have explained the lecture 8 so well that I've solved 9,10,11,12 by myself. Thank you sir ♥

    • @shaikasifali7141
      @shaikasifali7141 ปีที่แล้ว +4

      same here magic he bhai striver me

    • @santanu29
      @santanu29 ปีที่แล้ว +4

      Same here. I was so afraid of this topic but I could solve the problems even before watching the videos. I then watched the full video to understand the topic better and also for the space complexity and space optimization in the end

    • @mashapoguajay3322
      @mashapoguajay3322 ปีที่แล้ว

      bro in case of minimum falling path sum we have to use 1e9 and maximum falling path sum we should use -1e9 why

    • @aditya__mishraa__
      @aditya__mishraa__ ปีที่แล้ว +1

      @@mashapoguajay3322 We are using 1e9 big value to avoid the case. it will add a big value so that while choosing minimum it will avoid the max value.

    • @dhruv412
      @dhruv412 5 หลายเดือนก่อน

      samee

  • @shubhamsth9
    @shubhamsth9 2 ปีที่แล้ว +43

    I solved this problem all by myself, forming a recurrence relation and solving using recursion, updating it to memorization, and then converting the solution to tabulation and its space optimization. All of this without even starting the video, just by looking at the title and trying the problem by myself.
    Really grateful for your playlist, it follows a build-on-top approach, you take it from basics to advance, slowly increasing the complexity so the student doesn't get overwhelmed.
    Thank you

    • @shubh625
      @shubh625 2 หลายเดือนก่อน

      hi

    • @shubhamsth9
      @shubhamsth9 2 หลายเดือนก่อน

      @@shubh625 yes?

    • @shubh625
      @shubh625 2 หลายเดือนก่อน

      @@shubhamsth9 which college/company?

  • @nammi895
    @nammi895 2 ปีที่แล้ว +226

    Important : this question was asked in online round of dream11

  • @ankitadas5833
    @ankitadas5833 2 ปีที่แล้ว +103

    understood Sir .From DP Video 1 I was watching video in that mean time You suggested that At first complete at least lecture no 6 & 7 of recursion series .I paused then watched entire 19 videos of recursion series ,and then started watching this playlist And today in lecture no 12,I am able to build the logics slowly about the problem. Thanks Sir. I truly believe that whoever watching this lectures from beginning from the end of the series everyone can build logics on Dynamic Programming.

  • @tg62672
    @tg62672 ปีที่แล้ว +15

    Finally after 12 videos I'm feeling lot more comfortable with DP still not able to come with solutions on my own but i don't have to watch more than once to understand concepts. Infact i was able to do memorization and tabulation on my own. Hope i can build recursion logic too by myself after watching few more videos.

  • @nawazgaming6743
    @nawazgaming6743 ปีที่แล้ว +3

    I usually try to solve the problem mentioned in the video myself first then check Striver's intuition and solution of it. While searching for the problem of DP10 I accidently opened this problem(DP12) in CodingNinja website and started solving it. To my surprise, I was able to solve it and could build all the solutions by just following your steps. Thank you Striver! for teaching this concept in such a brilliant way. I was always afraid of DP as I could not get the intuition correct, but now I have gained a lot of confidence in it. You are indeed a GEM.

  • @navneetsinha8387
    @navneetsinha8387 6 วันที่ผ่านมา

    I can't believe that I solved this by myself, Recursion -> Memoization ->Tabulation -> space optimization.
    You are a great teacher.

  • @varunarora3453
    @varunarora3453 2 ปีที่แล้ว +30

    best teacher for Dp till now❤

    • @PIYUSH61004
      @PIYUSH61004 2 ปีที่แล้ว +1

      Completely agree with you!

  • @lavanyam3224
    @lavanyam3224 5 หลายเดือนก่อน +2

    It's unbelievable I solved this problem by myself after watching your previous videos. The quality of your teaching is top notch. Striver is really GOAT

  • @ahanavishwakarma3956
    @ahanavishwakarma3956 2 ปีที่แล้ว +6

    Solved all of the approaches including self optimisation myself. You are amazing! Thankyou

  • @sameekshamurdia5-yeariddph649
    @sameekshamurdia5-yeariddph649 ปีที่แล้ว +2

    solved the problem without even watching the tutorial and did recursion -> memoization -> tabulation -> space optimization all by myself🥺🥺 Thank you striver❤❤❤❤❤

  • @vipulmaheshwari2321
    @vipulmaheshwari2321 2 ปีที่แล้ว +7

    You Know what, I am binging this DP series like I did with the Peaky Blinders, Game of Thrones, Suits, Friends naming a few.. Amazing Job Striver..

  • @haetz9686
    @haetz9686 2 ปีที่แล้ว +6

    Understood You make the problem as easy as it was not. Thanks for giving us such wonderful video lectures.

  • @garvitrajput8491
    @garvitrajput8491 2 ปีที่แล้ว +4

    Phle mai dp ko lekr bhut pareshan tha ,
    Phir is DP ultimate Series ko dekhna shuru kiya,
    ab mai recursion se space optimisation tak phunch jata hoon.
    Thanks a ton @striver bhaiya 😎

  • @anshumanpanigrahi7817
    @anshumanpanigrahi7817 2 ปีที่แล้ว +2

    Very happy that I solved this question in all the formats except the space optimization, by just reading the question and given test cases.
    I still watched the whole video afterwards because I love listening to his explanations. You're doing a great job brother.

  • @harshadmehta5209
    @harshadmehta5209 2 ปีที่แล้ว +13

    wow I cant believe it I solved this question on my own before starting the video . thanks a lot striver

  • @KUMARSAURABH-s5i
    @KUMARSAURABH-s5i หลายเดือนก่อน

    I am following this dp series since the beginning and I was able to solve this question without your tutorial.
    Thanks a lot striver!!

  • @nict8094
    @nict8094 2 ปีที่แล้ว +4

    15:00 *TimeComplexity:* for the BruteForce: isn't it like below?
    Assume for a moment we have a single, hardcoded starting point, somewhere in the last row.
    From that, we'll be picking 3 paths, until we reach zero, so it's: 3^N.
    But then, we do this for every M column, right? So:
    *TC is: O(M (3^N))*
    *SC: O(N)* we go max N stack frames deep

    • @unknownuser8912
      @unknownuser8912 2 ปีที่แล้ว +2

      exactly I was thinking the same

    • @vatsalmanvar3383
      @vatsalmanvar3383 2 ปีที่แล้ว +3

      isn't it should be O( 3 ^ (n*m) ), because in previous videos we are exploring only one point and still the TC is O( 2 ^ (n*m) )??

  • @logeshkumar1852
    @logeshkumar1852 หลายเดือนก่อน

    I just watched 2 lectures on 2d dp .. now i solved 2 problems withought seeing the solution . thank you striver

  • @KalingaAbhisek
    @KalingaAbhisek 2 ปีที่แล้ว +3

    understood. You did it from last so I had curiosity to do it from top to down in recursion and i did it. Because of you and the way you teach I can think of different approaches. Thank you striver bhaiya❤.

  • @DivyanshukumarCs
    @DivyanshukumarCs ปีที่แล้ว +2

    Understood sir,NOW I AM ABLE TO WRITE RECURSION CODE AND RECURRENCE TREE BY MYSELF AND COVERSION TO MEMOIZATION AND TABULATION.
    THANKYOU FOR YOUR PREMIUM CONTENTS.

  • @darksidekiller5300
    @darksidekiller5300 2 ปีที่แล้ว +7

    Sir, I was able to solve this question all by myself... This is the first question of the series which I was able to solve all by myself, without any reference/ hint anything .... still I cross checked my method with yours ... And I clearly understood. Thank you😊

  • @ajayprajapati3029
    @ajayprajapati3029 2 หลายเดือนก่อน

    "us" what a teaching skill bhaiya .
    easy path to learn DSA.❣❣❤

  • @sharmakartikeya
    @sharmakartikeya 2 ปีที่แล้ว +10

    I was able to code the memoization, tabulation and space optimization by myself!
    Thank you bhaiya 😄

  • @atryshsharma773
    @atryshsharma773 ปีที่แล้ว +1

    I just watched this video randomly after coming across this question and now the concept seems so interesting to me, that I am going to watch every video on dp and recursion of yours! Keep up the good work sir!

  • @parthjangid5966
    @parthjangid5966 ปีที่แล้ว +5

    Thank you so so so much! This series has made my life easy ❤

  • @PIYUSH61004
    @PIYUSH61004 2 ปีที่แล้ว +1

    Understood man! I did this question without watching this video. I was able to come up with the plain recursive, memoization and tabulation all 3 methods.

  • @mohitnaik444
    @mohitnaik444 2 ปีที่แล้ว +41

    Dp feels like a child's play, when learning from u. Thanks a lot Striver Bhai♥

  • @hyperkon9807
    @hyperkon9807 2 ปีที่แล้ว +1

    Recursion was my weakest topic and you build my logic soo well that I made the algorithm before you.
    Thank You!

  • @nikitakubavat8142
    @nikitakubavat8142 2 ปีที่แล้ว +3

    The best dp series I have ever watched 😍!!! "Understood" sir.

  • @phantienminh164
    @phantienminh164 10 หลายเดือนก่อน +2

    you are one of the best youtuber at this, i understood everything in your video ❤❤

  • @SecondYearStudent
    @SecondYearStudent 2 ปีที่แล้ว +3

    Thanks Striver for making my life so easy

  • @abhijeetmishra3804
    @abhijeetmishra3804 7 หลายเดือนก่อน

    Striver is Competing with himself only to provide more and more better content.....as soon as recursion tree gets over ... i am able to write all 3 approaches by my own. Thank you Striver...this is what your videos have done to me and many of us.... keep growing...

  • @shwetakirave3726
    @shwetakirave3726 2 ปีที่แล้ว +4

    Incredible... Amazing... great... best ever dp explanation UNDERSTOOD UNDERSTOOD UNDERSTOOD

  • @deveshyadav7830
    @deveshyadav7830 2 ปีที่แล้ว +2

    Amazing dp playlist. I was able to solve this question on my own for all the 4 approaches. Feeling really very confident.

  • @parthsalat
    @parthsalat 2 ปีที่แล้ว +9

    *Time complexity*
    Recursion: 15:45
    Memoization: 24:22

  • @stylishstarrick882
    @stylishstarrick882 ปีที่แล้ว +2

    YOUR DP SERIES FEELS AMAZING NEVER FELT DP SO EASY CAN SEE PATTERNS EASILY NOW THANK YOU FOR TEACHING ❤❤❤❤❤❤🙏🙏🙏🙏

  • @suchithreddy733
    @suchithreddy733 2 ปีที่แล้ว +5

    DP now seems like childs play striver!! Hats off for this wonderful explanation!!❤

  • @r_uhi05
    @r_uhi05 หลายเดือนก่อน

    I am very happy to share that I have solved this question where I wrote the recursion, memoization, tabulation and space optimization all by my own. Thankyou striver for your great explanation in the previous lectures.

  • @daskool5420
    @daskool5420 2 ปีที่แล้ว +4

    Recurssion Solved by myself and dp
    Understood.❤️

  • @viditkhandelwal3241
    @viditkhandelwal3241 2 ปีที่แล้ว +15

    I think we will get 102 instead of 200 in rd (21:00)

  • @ayushichoudhary1019
    @ayushichoudhary1019 7 หลายเดือนก่อน

    Was able to code the memoization, tabulation AND the optimal solution on my own for this one after solving the triangle problem. All thanks to you Striver!

  • @pragneshamadavadi2267
    @pragneshamadavadi2267 ปีที่แล้ว +23

    kids: binge watch Netflix web-series
    legend: binge watch striver's dp-series 🔥🔥🔥🔥

    • @mayanksingh7501
      @mayanksingh7501 4 หลายเดือนก่อน +2

      binge watch se ni hoga fayda bhai, solve kr lena khud se bhi

    • @asmisrivastava3934
      @asmisrivastava3934 2 หลายเดือนก่อน +2

      @@mayanksingh7501 😂

  • @kartiksuman9814
    @kartiksuman9814 2 ปีที่แล้ว +1

    Understood very well bhaiya...what u r doing is way way higher than liking,and commenting... may the good god bless u always, and u also get the same help from your senior ones as we are getting from you...thanks a lot. And ya, as u had in the first video of this series that,a t the end u'd feel that this is at a different level from other ,u indeed proved it as well.

  • @saurabhkumarsingh9550
    @saurabhkumarsingh9550 2 ปีที่แล้ว +5

    👌🏻👌🏻👌🏻👌🏻 understood crystal clear 👌🏻

  • @oqant0424
    @oqant0424 ปีที่แล้ว +1

    understood all the four approaches
    i like ur way how u teach us logic building!

  • @arnabdutta4662
    @arnabdutta4662 2 ปีที่แล้ว +5

    For JAVA users do -
    prev = curr.clone()
    instead of prev = curr
    :)

    • @nashidnoormohammed4027
      @nashidnoormohammed4027 2 ปีที่แล้ว

      why wont prev=curr work?

    • @arnabdutta4662
      @arnabdutta4662 2 ปีที่แล้ว +2

      @@nashidnoormohammed4027 as Java is pass by reference so if we do prev = curr , prev will start pointing to curr , i.e. both curr and prev are now point to the same array any changes made will be reflected in both the array simultaneously. And hence the prev will not contain information of the previous row
      For faster operations instead of array.clone we can use system.arrray.copy method to copy the elements of curr to prev

  • @tasneemayham974
    @tasneemayham974 ปีที่แล้ว

    GUESS WHAT!!!! I solved it allll aloneeee!!!!!!!!
    Everything recursion, memoization, Tabulation and Space optimization!!!! STRIVER YOU ARE THE BESTTTTTTTTT!!!!!!!!!!!!!!!!
    BEST BEST BEST!!!!

  • @amitranjan6998
    @amitranjan6998 2 ปีที่แล้ว +5

    For recursive solution : TC should be 3^(N*M) ... coz for every cell I am exploring 3 different path , total cell is N*M , correct me if I am wrong ,SC is also N*M

    • @chetanraghavv
      @chetanraghavv 2 ปีที่แล้ว +7

      I think correct TC for recursion will be O( M * (3^N) ): 3^N for the paths (as Striver mentioned) and M because of the for loop in which recursion is called. It will not be 3^(M*N) because it is not like that there are three options for every cell in the matrix but is more like there are M paths (starting from any cell of last row) and each path takes 3^N as each element in that path have three options.
      As for space complexity it will be O(N) as at any time the height of recursive tree will be N (number of rows) and only when stack frames of this call are deleted, recursion starting from next cell of last row called.

    • @pqrstwxyz1175
      @pqrstwxyz1175 11 หลายเดือนก่อน

      ​@@chetanraghavvYou are absolutely correct 💯

  • @ShivanshuTripathi21BCE618
    @ShivanshuTripathi21BCE618 20 วันที่ผ่านมา

    its because of striver only i able to solve this by myself as you explained well in lec-8 Thank you Striver

  • @AdityaRajVerma-io3pr
    @AdityaRajVerma-io3pr 6 หลายเดือนก่อน

    coded down rec + memo + tabu + spac.opti. all my self. thanks bro, u r a gem

  • @aayushgakhar3525
    @aayushgakhar3525 หลายเดือนก่อน

    good question , was able to solve on my own after few trials and errors

  • @piyushsharma7795
    @piyushsharma7795 ปีที่แล้ว

    I solved this question on my own. I can't tell anybody how confident I am feeling. Thanks striver.

  • @sanchitkadwe90
    @sanchitkadwe90 2 ปีที่แล้ว +1

    Bhaiya 2-D dp ka first video dekha aapka and guess what,baki sare videos ke questions khud se hi solve ho rahe the....this is the strength of your qualilty content bhaiya.Keep it up,God bless you.

  • @SaurabhMishra-e8m
    @SaurabhMishra-e8m ปีที่แล้ว

    Very nicely explained...I was able to solve this on my own bcs I had watched earlier videos of this series. One point which I wanted to make that instead of traversing the for loop to find max, we can check for condition of i == n in our first inner loop only and store the max value of last row....it will reduce extra for loop just to find the max value in last row...

  • @RCB895
    @RCB895 6 หลายเดือนก่อน +1

    It will be too easy for you if you follow the playlist from the starting.
    Try to listen him carefully notice him what he actually doing to solve the problem.
    Thank you sir for this amazing playlist

  • @dishagupta7446
    @dishagupta7446 2 ปีที่แล้ว +1

    I was never able to learn dp and here following this series, I am able to solve most of the ques myself.

  • @rohitkeshri9571
    @rohitkeshri9571 6 หลายเดือนก่อน

    this is the best ever dp playlist on internet , i think.

  • @aakanksha795
    @aakanksha795 2 ปีที่แล้ว +2

    Understood! Thanks Striver for making DP easy :)

  • @ojasvijgd
    @ojasvijgd 6 หลายเดือนก่อน

    UNDERSTOOD
    THANK u so so much for this amazing series thanks a lottttt

  • @SelvaArumugam-xq5mf
    @SelvaArumugam-xq5mf 9 หลายเดือนก่อน

    I couldn't believe that I solved the problem before seeing your vedio. Understood Raj Vikramadithtan Sir aka "Striver😉"

  • @gurleensoni7124
    @gurleensoni7124 2 ปีที่แล้ว +2

    one of the best dp series on youtube

  • @dipaligangawane980
    @dipaligangawane980 2 ปีที่แล้ว +2

    Really Really wonderful series. Understood everything.

  • @rahul_siloniya
    @rahul_siloniya ปีที่แล้ว

    This question came in IVP coderush this year (2023). It was about a random number generating machine which has layers and each layer has multiple nodes which can have three states 0, 1 and 2 which increase, keep same or decrease the number passed and you have to output the maximum value which can be obtained after going through all layers. And from each node you can only go to - the node directly below, bottom left and bottom right. I mean this question is happening.

  • @arun1p7
    @arun1p7 2 ปีที่แล้ว +1

    completely understood. Best videos I have ever experienced. Thanks Man , Keep it Up!

  • @tanyagupta4247
    @tanyagupta4247 2 ปีที่แล้ว +1

    I solved this whole ques by myself. Thankyouuu so much Striver😍

  • @vikasbagri1225
    @vikasbagri1225 2 ปีที่แล้ว +2

    understood it very well...
    Thanks for this amazing series

  • @sangeetasharma8574
    @sangeetasharma8574 ปีที่แล้ว

    understood Striver.
    coming to this lecture I feel the confidence in solving DP.
    Thank You for this amazing teaching.

  • @suhaanbhandary4009
    @suhaanbhandary4009 ปีที่แล้ว

    Understood!!, And thanks for the DP Series, For the last 3 Videos I am able to solve all steps by myself because of how you have explained it!!

  • @Morimove
    @Morimove 8 หลายเดือนก่อน

    i did it myself in just few minutes. very happy. reminder for future me

  • @yashlakade179
    @yashlakade179 2 ปีที่แล้ว +1

    Thank You Bhaiyya!! This is the second question that I was able to solve on my own from Recursion to the Space Optimised version !!😇😇

  • @ArdentMusicLover
    @ArdentMusicLover 6 หลายเดือนก่อน

    Love your DP series! It helps me demystify DP. Thank you for sharing

  • @Wuaners
    @Wuaners 3 วันที่ผ่านมา

    Thank u so much for all of this videos, u r awesome.

  • @mugambo5505
    @mugambo5505 ปีที่แล้ว

    thank u so much raj sir.
    today i solved the entire problem before watching the explanation.
    first recursion -> recursion +memoization -> tabulation -> tabulation with space optimization.
    thank u sir this entire process is wonderful to break a hard problem❣❣❣
    and UNDERSTOOD 😁😁😁

  • @bhagatalisha
    @bhagatalisha 19 วันที่ผ่านมา

    Sir you are the bestestest, Understood by heart

  • @abhishekkarn8918
    @abhishekkarn8918 6 หลายเดือนก่อน

    Solved it without watching the tutorial. Thanks Striver

  • @soniyarizvi1200
    @soniyarizvi1200 ปีที่แล้ว +1

    Hey striver , love this series , this series makes DP clear to me . "Understood" ❤

  • @dharmeshpoladiya9047
    @dharmeshpoladiya9047 2 ปีที่แล้ว +2

    Understood 💯💯 Great Explanation. Thank you very much for all you efforts🔥🔥

  • @dps3902
    @dps3902 ปีที่แล้ว

    god level teaching,understood. if only every teacher were like you!!

  • @Ishowmeat8
    @Ishowmeat8 2 ปีที่แล้ว +2

    This guys is making videos for us even on the republic day .....really hats off to you striver bhaiyyya

  • @tgayush1424
    @tgayush1424 2 หลายเดือนก่อน

    Awesome solution,explanation.

  • @chirag7694
    @chirag7694 2 ปีที่แล้ว

    Understood bhaiya, I solved this by myself all 4 ways. Bahut bahut dhanyavad bhaiya

  • @sanketkulkarni2100
    @sanketkulkarni2100 2 ปีที่แล้ว +1

    Just watched first 3 -4 minutes and solved on myself thanks

  • @pratyakshpandey2248
    @pratyakshpandey2248 ปีที่แล้ว

    Coded tabulation right away within 10 minutes of reading the question... Thankyou striver!!

  • @VikasBagri-i5j
    @VikasBagri-i5j วันที่ผ่านมา

    understood : ) thanks for this amazing series

  • @sahilbadkul7130
    @sahilbadkul7130 2 ปีที่แล้ว +2

    Understood man .
    Really great explanation.
    Thanx for this effort.

  • @moonlight-td8ed
    @moonlight-td8ed 2 หลายเดือนก่อน

    thank you striver.. did all the problems from lec 8 by myself.. even space optimization....

  • @MukeshKumar-cc3uh
    @MukeshKumar-cc3uh 7 หลายเดือนก่อน

    Real Quality content here. Thank you Striver. "Understood". ♥

  • @CodeMode9313
    @CodeMode9313 ปีที่แล้ว

    Miracle !! lappu sa sachin did this question by own ...seedha space optimized way me :)

  • @rapidreplay6062
    @rapidreplay6062 7 หลายเดือนก่อน

    understood Sir .From DP Video 1 I was watching video in that mean time

  • @sandeepparimi5316
    @sandeepparimi5316 ปีที่แล้ว +1

    Thanks for sharing this knowledge with us.

  • @studyonline3236
    @studyonline3236 ปีที่แล้ว

    You can store the values in-place and have SC=O(1) for dp (no need of space optimization if the array/matrix isn't read-only)

  • @rishabhgupta9846
    @rishabhgupta9846 ปีที่แล้ว

    Understood,able to solve the problem by myself.Thank you striver for such wonderful playlist

  • @hashcodez757
    @hashcodez757 หลายเดือนก่อน

    "UNDERSTOOD BHAIYA!!"

  • @shaddyrogue9430
    @shaddyrogue9430 ปีที่แล้ว

    Wow before watching the Video the solution came to my mind. seeing the same solution being explained in the video is awsm. Thanks for great explanation.

  • @AJ-zo4pr
    @AJ-zo4pr 6 หลายเดือนก่อน

    Tc with memoisation will be n^3 because we are calling recursion inside a for loop for every j .

  • @saseerak8763
    @saseerak8763 2 ปีที่แล้ว +1

    I solved everything by myself!!thanks a ton.

  • @shahutsav1661
    @shahutsav1661 ปีที่แล้ว

    yes it gives TLE by doing it through memoization. tabulation has to be used

  • @divyanshusingh2396
    @divyanshusingh2396 2 ปีที่แล้ว

    ' Thanks a lot striven for your support