Dynamic Programming 1D - Full Course - Python

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

ความคิดเห็น • 176

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

    🚀 neetcode.io - Get access to every current and future course I ever create.
    Spreadsheet from the video: docs.google.com/spreadsheets/d/1A2PaQKcdwO_lwxz9bAnxXnIQayCouZP6d-ENrBz_NXc/edit?usp=sharing

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

      Hi Mr NeetCode dude, I just wanted to ask, do you have tier pricing that changes based on the country? For example, there are developing countries in Africa that generally tend to have a lower pricing since the $ is extremely high to the ZAR - South African Rand. There are other countries as well that would struggle. Do you intend on having a way to assist us too? I'm asking because you're having a launch sale and perhaps by the time you even get a chance to consider different tier pricing based on different countries it may be too late :( Do know however, I'm extremely grateful for the existence of NeetCode and everything that you've done!

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

      Dear Neetcode, Could you please publish a video full course on graph theory

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

    I'd like to share a few points. With DP, one of the main challenge is how do you recognize a problem is indeed a DP problem. It can be misleading at times that a given problem is indeed a DP problem.
    Therefore, I'd say that this course and more upcoming DP parts that you might be posting, would be great if you start each question with pure analysis of why this problem is a DP problem to begin with. Taking a view on the question as if it has never been seen and then you apply contain ideas to identify if its a DP problem or not.
    The reason I'm bringing this point is because it just so happened that one of my friend shared his experience with me that he had a few years ago where during interview, he thought the problem is a DP and after 25 mins in the interview, he realized that's its not but he had waisted essentially all the critical time.
    Long story short, would be great that for every question, would be great to talk about what attributes of such problem made it obvious that its a DP problem.

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

      Facts. for me personally almost every question i do im always trying to look for a dp solution but i dont really know if it is a dp problem

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

      I get your point and I agree but I believe it's one of those things that you have to build an intuition for, in other words, it comes with practice.

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

      In an algorithms class one first learns about greedy algorithms, then memoization before moving into DP. I think this helps build an intuition. So anyone looking to gain intuition about when DP is applicable may benefit from reading up on those concepts first, especially memoization.
      That said, the first example of the fibonacci sequence is a good start. Think of times where work has to be repeated because future calculations require the work of previous steps, as in the fibonacci sequence. With memoization, instead of re-calculating every step, we can save the results at each step and recall the solution in future function calls to speed up the time needed.

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

      Take this as how to recognise the problem is a DP:
      1. With pen & paper, do the problem have sub-problems?
      2. Does the sub-problems return similar value or in a pattern that will be used for next iteration(sub-problem)?
      If it is, then try to solve this way:
      1. you can follow tabulation(array to store data) or memoisation(hashSet or hashMap).
      2. Sometimes the problem may not ask for the dp array or dp hash, then you may use two variables(think these as pointers that may need to update at each iteration). At the end return the value.

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

      Good question, another one that I have is how do we come to understand that there is a binary algorithm at place? Either we take the current value or we do not? It would appear that we could just loop through all possible options (except the current one), which would still work, but be slower and get a TLE on leetcode

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

    You're doing amazing work for all who wants to be good at algorithms and pass interviews. Mad respect!

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

    Thanks a lot brother. May God bless you abundantly

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

    I've been watching your videos so much through my interview preparations that your voice sounds like a mother's lullaby to me at this point.

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

    Ohhh neetcode only if I could express how much I owe you for improving my problem solving skills

  • @arno.claude
    @arno.claude 2 ปีที่แล้ว

    Thanks!

  • @jonathanpangilinanjr.9905
    @jonathanpangilinanjr.9905 2 ปีที่แล้ว +2

    Thank you very much for this video. I finally solved my very own medium dp lc after watching a quarter of your video. I'm gonna finish this and hopefully, I can stand on my own feet after.

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

    I'm not sure who needs this, but I guess we can use the similar format for all 1D problems-
    class Solution {
    public:
    int solve(vector& ways, int n, int start){
    if(start >= n){
    // no way to reach the end
    return 0;
    }

    if(ways[start] != -1){
    // already calculated
    return ways[start];
    }

    // not cal
    // need to cal

    // it always depends on the next problem
    return ways[start] = solve(ways, n, start + 1) + solve(ways, n, start + 2);
    }

    int climbStairs(int n) {
    // using the concept of DP
    vector ways(n + 1, -1);

    if(n < 2){
    return 1;
    }

    ways[n] = 0;
    ways[n-1] = 1;
    ways[n-2] = 2;

    // ways means number of ways we can reach the end
    // if the start position is i

    solve(ways, n, 0);
    return ways[0];

    }
    };

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

    The best timing. İ was in need of this. Thank you so much Sir.

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

    This is amazing, thanks for all the work you do.

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

    I paid for the lifetime membership yesterday, but this super long and helpful video is just for free.
    So, goodbye my money, I have to support this cool guy indeed.

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

      that's a great pic of Son Ye-jin!

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

      Well, this does not include the 20 mins 1D DP course in his pro member content. Your money is still worth it.

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

    Bro, this is gold.

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

    I agree, climbing stairs was indeed explained top notch.

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

    Dear Neetcode, thank you for uploading this. I have been following your content for quite some time and I really appreciate the effort you have put into creating content for DSA. However, I would really appreciate it if you could highlight the core in-depth reason for why such DP patterns exist, and how to identify them. So a template, instead of solutions.

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

      DP is used when you have n ways to do something. Here that n is the number of steps you can take. The question can be changed to say you can can take 1 or 2 or 3 steps. Now if you give 20 stairs, you have 3 ways to get there. As you can see there is no straight forward answer. This is where DP comes in the picture. DP allows you to break the problem down into a very very small sub problem. Once you solve small sub problem then next problem builds on top of it.
      So instead of solving to 20 steps, solve it for smaller number. What's the smallest number you can solve it for???? 0. Also in dp questions where we have to count n ways, I find it much better approach to go backwards. Instead of finding ways to get to 20, find ways to get to 0.
      for 3 steps where you are allowed to take 1or 2 steps, it'd look like
      3
      2/ \1
      1 2
      2/ \1 2/ \ 1
      -1 0 0 1
      2 / \1
      -1 0
      Anytime you see 0, you have a positive case meaning that path will yield correct result. If value goes < 0, it means it won't work. So the code will look like
      public int GetCount(int totalSteps) {
      if(totalSteps == 0) return 1;
      if(totalSteps < 0) return 0;
      return GetCount(totalSteps-2) + GetCount(totalSteps-1);
      }
      Then you add memoization to optimize the time but you get the idea.
      Its an amazing concept but once you get a hang of it, you'd feel most satisfied solving these questions.

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

      @@sherazdotnet you're awesome

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

      @@sherazdotnet thanks bro

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

    Climbing Stairs can be written in just three lines(instead of five), in python for swapping two variables you don't need a Temp variable, you can use
    a, b = b, a or ( one, two = one + two, one )
    class Solution:
    def climbStairs(self, n: int) -> int:
    one, two = 1, 1
    for i in range(n-1):
    one, two = one + two, one
    return one

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

      For anyone reading this, reason this works is because in python the expressions on the right side of the = sign are evaluated first, therefore one + two and one are calculated based on original values of one and two. Then it assigns the results to one and two on the left side

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

      @@longvu7746 goated

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

    Best playlist to learn DP. Thanks mate

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

    great stuff! hope for other topics covered the same way!

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

    I can't believe this is free. Thank you NeetCode!

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

    Waiting for this ,best explaination ever 💥💥

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

    You did it finaly, God Damn, you have no idea what great help you just did, damn bruh you are God sent

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

    Amazing!! Waiting for 2D DP :)

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

    Oh my man this was so needed thankyou so much sir ❤️

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

    2:08:59 why is the third value in the min necessary (just n). cur_max can never be less than 1. If cur_max is 1, its the same as n, if its larger, it's bigger than n.

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

    Thanks a lot, We need more such full course vedios on each module, It really helps

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

    This is what I'm looking for! Thank you!

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

    I really appreciate your work, your explanation really works

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

    In the climbing stairs problem, why is the value for the base case 1? If we are at the base case, then there are 0 ways to reach the base case right….? I realise if we initialise the base case to zero then the code won’t work. I just want to understand what other reason there is for the base case to be one.

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

      The original problem is about routes - how many routes can you take.
      from 5 to 5 you can take 1 route
      from 2 to 5 you can take the route that will lead you to 3, or the route that will lead you to 4

    • @willreed9433
      @willreed9433 24 วันที่ผ่านมา

      @@SkillR1 ik both these comments are super old but I think OP is saying: from 5 to 5 you can take 0 routes, since moving at all would lead you away from 5. it is counter-intuitive when thinking in literal terms. So the route of "not moving at all" is considered 1 route, the only possible route, when already standing on the final step (to make it logical in a real life scenario).

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

    Dude this is amazing material! Thank you so much for the education and your teachings! When I get a job, Ima have to take you out for lunch! Truly appreciate your work buddy =)

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

    Can we improve the efficiency at 2:24:28 by mutating wordDict into the form where the key is len(word) and the value is a list of all words of that length (no extra space). Then we can check:
    for key in wordDict:
    if i+key in dp and dp[i + key] = True:
    for word in wordDict[key]:
    #check the word
    That way, you eliminate the vast majority of building dp.

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

    Absolutely love your content. It’s so neet and easy to follow for the layman. Do you have a Rumble channel as well?

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

    the two variable approach to solving the decode ways is missing in this video, but really helpful video. Thanks a lot.

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

    Here is my solution using Recursion + Memoization. Code is written in c#
    public int CountSteps(int totalSteps, Dictionary memo) {
    if(totalSteps ==0) {
    return 1;
    }

    if(totalSteps < 0) {
    return 0;
    }

    if(memo.ContainsKey(totalSteps)) {
    return memo[totalSteps];
    }

    var usingOneStep = CountSteps(totalSteps-1, memo);
    var usingTwoSteps = CountSteps(totalSteps-2, memo);

    memo[totalSteps] = usingOneStep + usingTwoSteps;
    return memo[totalSteps];
    }

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

    You. Are. Absolutely. Amazing!!!!

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

    Neetcode is the Hero we dont deserve but the hero we needed. He is the Dark Knight of LeetCode.

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

    Wow, this is amazing tutorial, DP in many case (n*2) -1 or ( n- n,pow(2)) 😀, great work

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

    Watching this in the weekend. I can't be happier

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

    Thanks neetcode

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

    great content

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

    Thanks man. Respect from 🇮🇳

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

    @neetcode Props on the great video! Are palindromic substrings and longest palindromic substrings relevant to DP? If not, why are they in this compilation?

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

    Thanks neetcode eagerly waited for this, Hope u will upload this type of content more.

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

    I Really appreciate these efforts you are taking man🔥

  • @347harsha
    @347harsha ปีที่แล้ว

    Thanks Guru. You are my Dronacharya

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

    13:20, at the last step 5, how many ways to land on the same step land on itself, why 1?

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

    Brute Forced a super inefficient piece of code :P :
    def wordBreak(self, s: str, wordDict: List[str]) -> bool:
    length = len(s)
    for w in wordDict:
    if length==0:
    return True
    while length>=0 and len(w)

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

    Hello everyone!
    I have a question regarding the problem 300 "Longest increasing subsequence". Why didn't we write:
    LIS = [1] * (len(nums)+1) instead of LIS = [1] * len(nums)
    For example, in the previous problem "Word Break" we've used the +1. In which cases do we use the +1 when we define dp and in which cases we do not?
    Thank you

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

    At 2:09:00 the nasty bug could be avoided using a pure fold instead of mutations

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

    love you dude....
    if God is there... God bless you

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

    So incredible you could put in tonnes of hours into quality work. Thanks for creating this amazing resource.

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

    For problem "decode ways" Doesn't initializing dp[len(s] = 1 mean that null string can be decoded in 1 way? I understand how this works in code but conceptually I don't see how a null string can be decoded

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

    That infinite loop while trying to add to the same set you are iterating through was confusing me. Thanks!

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

    Oh my God ! Can't thank you enough. Thank you so much for this

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

    This is way simpler
    for i in range(2, len(nums)):
    temp = min(nums[i-2] , nums[i-1])
    nums[i] = nums[i] + temp
    return min(nums[-1], nums[-2])
    btw I got this idea by seeing ur house robber1 leetcode problem

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

    Great stuff... Learnt a lot sir

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

    you are god for me and thanks for these dp course in python🙂🙂

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

    Very helpfull course, Highly recommended

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

    in maximum product subarray how does the solution ensure the min max product is from a contigous sub array and not from a non contiguos one

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

    Dear Neetcode, Could you please publish a video full course on graph theory

  • @ra90451
    @ra90451 7 หลายเดือนก่อน +1

    Odd or even length strings does not matter
    static boolean isPallindrom(String str) {
    boolean isTrue =false; int l=0; int r =str.length()-1;
    while(r>l)
    { System.out.println(str);
    if (str.charAt(l)==str.charAt(r))
    {
    isTrue=true;
    }; l++; r--;
    }
    return isTrue;
    }

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

    Thanks!Could you do live dynamic programming session , so we can learn from your thought process?Btw( for 02:45:45 ) if the input array is [1,4,11,5} dont [1,4] and [5] is even subsets,even if they are not equal to half of sum of the array?

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

    THANK YOU SO MUCH!

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

    At 1:57:00 you're solving Maximum Product Subarray not Longest Increasing Subsequence

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

      thanks, fixed

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

    this video helped me a lot. Thanks

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

    You’re doing god’s work

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

    @ 18:53 the code doesn't run well for a higher value of n. I tried with a value of 500,000. It hung.

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

    For the last problem, can someone explain why the time complexity is not 2^n? If all the sum is unique, then the size of set should double each time, thus it's 2^n. Why doesn't this happen?

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

    thank you for the contribution for the human kind.

  • @HaNguyen-n3o9j
    @HaNguyen-n3o9j 12 วันที่ผ่านมา

    thank you so much!

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

    First of all, a lot of thanks for what you have done, such effort is priceless and let good things happen to you! :)
    Things I would have done differently: I have just finished watching the first problem, which is Climbing Stairs, and I have to say your approach to explaining it is a bit misleading in its final part.
    First, you're indexing your array from 0 to 5, but it's dp[0] that contains the number of ways to reach 5. At the same time dp[5] = 1 and that might be confusing because clearly there's more than 1 way to reach 5 from 0 to 5. I do realise that you decided to go backwards but why? Your initial explanation was from 0 to 5.
    Also, when you show the code, you have no array in there at all. Yes, it's clear that this problem is a plain Fib numbers problem, but for someone who's just started that might be confusing.
    Anyway, thank you for your effort and don't think of me as someone unthankful - I'm not. I've written all that for those who may struggle trying to understand these things because I've been there multiple times myself.

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

    Is this video a combination of all the previous videos cut together? or is it recut/edited to string together experiences drawn from previous questions?

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

    I love this, Thank you! Can you do the same for dfs and bfs algorithms?

  • @彭程-u8k
    @彭程-u8k ปีที่แล้ว

    I have a question for Maximun Product Subarray. What if the array is just [0], your code will output 1 as u set curMax as 1 by default. However, the ans should be 0 right? Maybe I should deal with this case especially?

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

    For the first 1D example, why does the fib sequence start from 1 and not 0?

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

    Absolute legend for this!

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

    your voice is very appealing.

  • @347harsha
    @347harsha ปีที่แล้ว

    @NeeCode in house robber 2 problem(problem number 213) if the robber starts stealing from house somewhere in middle . is it not separate case we have to consider . so I think for each number in array we have to skip it and execute the helper function

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

    Thank you neetcode 🙌

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

    Well done bro👏👏👏👏👏👏

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

    MY MAN IS BACK

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

    im confused by what i see and what i hear.
    you say the for loop will run until it reaches the beginning of the array. but whats written is -3, -1, -1
    so to my understand, it starts at index -3, then goes back -1 index every iteration, until it reaches the last index -1??
    that makes no sense to me

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

    1:01:07 - LeetCode 5 doesn't look like DP, more like two pointers.

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

    Thank you🫂

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

    I’m so confused. The maps generated in the problems all seem to have unique rules that arent clear to me. Feels like I missed a reading assignment maybe or lecture.
    The longest subsequence problem was troubling for me. ace. abcde. The matrix and comparisons sounded so natural but seemed convoluted to me. Why is this more efficient than sequence analyzer? Like the subsequence ace is visible in abcde without needing a map. (Granted I don’t know if that means there is a solution that can be computed more easily)
    These are great I just feel like an idiot cause I feel like I’m doing physics but didn’t learn the kinematic equations or something similar.

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

    Love you Neetcode ❤

  • @beyond-convention
    @beyond-convention ปีที่แล้ว

    Hi
    Your whiteboard is amazing. Which tool do you use for whiteboarding

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

    Thanks a lot!

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

    Nice video...can u please do a video about sliding window technique

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

    Amazing 👍🏼

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

    I didn't quite get it for the house robber 1 problem after watching 2 times. Maybe I failed in one key thought jump.

  • @Felix-lw7wo
    @Felix-lw7wo ปีที่แล้ว

    In DP for the 5th a stair, why is the value 5 and not 0?

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

    Love you man you are the best

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

    For the first problem, why is it that we put 1 in 5. If we are already if 5 and we can either go up by. 1 or 2 then shouldn't the possible step be 0?(As we are already in the solution). Can someone clarify pls

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

      I have the same question

    • @10199able
      @10199able 2 ปีที่แล้ว

      +1, because by this logic we should place 2 in 4

  • @ИринаГусев-р9ю
    @ИринаГусев-р9ю 2 ปีที่แล้ว

    When I see your video I realize the next 3 hours are gonna be coool

  • @s8x.
    @s8x. ปีที่แล้ว

    What’s the difference between this and recursion

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

    why is bottom up solution considered the "true" DP solution?

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

    how to identify if the problem is 1d or 2d dp ?

  • @AnkitKumar-jm3cz
    @AnkitKumar-jm3cz 2 ปีที่แล้ว +1

    Really Awesome work .
    Thank you so much Bro

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

    thanks for teaching me how to rob a neighborhood efficiently

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

    I am a sought of person who doesn't have any idea regarding dp, so can i watch it or not.