House Robber (LeetCode 198) | Full solution with diagrams | Easy explanation | Study Algorithms

Поділитися
Вставка
  • Опубліковано 12 вер 2024

КОМЕНТАРІ • 108

  • @manojtate9604
    @manojtate9604 7 місяців тому +18

    Top-notch explanation available on UA-cam, thanks!

  • @KodeWithKaran
    @KodeWithKaran 7 місяців тому +12

    finally i can sleep peacefully now...what an explaination. just wow... Thanks man!!!

    • @nikoo28
      @nikoo28  7 місяців тому +4

      Great to hear!

  • @zeltrax00
    @zeltrax00 10 місяців тому +9

    I used chatgpt to generate solution but I cannot understand it. After watch this video, I understand every single line of the chatgpt code. You're the best

  • @surendhar.v4952
    @surendhar.v4952 Рік тому +9

    Nikhil , You don't know , How you inspired me in teaching the problem and making the things simple and crisp.
    I really love the way how you taught your final thoughts.
    Gained some inspiration as well as the solution.
    Keep rocking Nikhil 🔥.

  • @yomamasofat413
    @yomamasofat413 3 місяці тому +4

    omg my brain is physically hurting from this...

  • @papercut._.
    @papercut._. 8 місяців тому +3

    bro you're a legend I can usually come up with memoization you're way of explaning made it easy for me to translate my understanding to tabulation. thanks a lot!

  • @rishichansauria3658
    @rishichansauria3658 Рік тому +5

    The way you explain is just awesome..please don’t stop.. after going through your videos I’m in love with DP ..thanku so much.

    • @nikoo28
      @nikoo28  Рік тому +1

      That is so amazing to hear 🤩

    • @serg1778
      @serg1778 Рік тому

      @@nikoo28 really awesome )

  • @siddharthmehta4223
    @siddharthmehta4223 Рік тому +4

    dayum...... awesome explanation brother. bows down. live long Nikhil.

  • @hari7110
    @hari7110 7 місяців тому +4

    Bro your explanation is just awesome!! u explained each step in detail

  • @malishagavali9225
    @malishagavali9225 21 день тому

    i first went through the entire playlist of DSA by kunal and now Im here to learn the remaining topics. You honestly teach so well!

  • @010101dddm
    @010101dddm Рік тому +8

    Best explanation on you tube, thank you

  • @hamzahahmad1670
    @hamzahahmad1670 3 дні тому

    Really grateful for your thorough explanations, Nikhil. They help clarify each problem and its solution very clearly.

  • @carl1809
    @carl1809 8 місяців тому +2

    Amazing explanation. I was looking everywhere why this works and you manage to explain it in a way that clicked

  • @lucianpetriuc7373
    @lucianpetriuc7373 6 місяців тому +1

    Leetcode is art and you're Picasso. Incredible explanation Nikhil!

  • @kvnrthr1589
    @kvnrthr1589 Місяць тому

    Fantastic explanation! I watched a few other videos and didn't understand, but with yours the logic finally clicked...

  • @AKumar-p9f
    @AKumar-p9f 2 дні тому

    Crystal clear explanation! Great job!!!

  • @TalesOfGranny
    @TalesOfGranny 8 місяців тому +2

    Very well explained. U have knack of teaching

  • @varoonsb
    @varoonsb 2 місяці тому

    Thank you so much! First time seeing someone explaining solution as good as NeetCode1

  • @manishbarnawal2865
    @manishbarnawal2865 6 місяців тому

    My First watch of this channel video !! Great explanation !! This I call as a social service which any one can avail in this country and will remember your explanation !! Subscribed !!

    • @nikoo28
      @nikoo28  6 місяців тому

      thanks for the sub!!

  • @sukyuit
    @sukyuit 10 місяців тому +1

    max waali condition jo aapne btai woh hum pehli baar mein kaise sochein khud se ,for future problems jo developer solve krega

    • @nikoo28
      @nikoo28  10 місяців тому

      for dynamic programming, the more you practice, the more patterns you will start seeing. Most of the problems work on the same idea, the words are just twisted.
      One thing that often helps me is visualize where do I have to ultimately reach. Then start to build a backwards solution.

  • @qR7pK9sJ2t
    @qR7pK9sJ2t 8 місяців тому +1

    Excellent.. The best explanation on utube !

  • @anarych1
    @anarych1 6 місяців тому +1

    Much better explanation than neetcode's one. Thank you!

    • @devprasad8767
      @devprasad8767 2 місяці тому

      Yes, but his code is more optimal in space complexity

  • @shraddhajain8935
    @shraddhajain8935 Місяць тому

    your explanations are amazing,, I understood it quickly

  • @DilshadAhmad-pc1tm
    @DilshadAhmad-pc1tm 7 місяців тому +1

    Bro..U r tooo good.. The way u explained is awesome, super. Please keep it up...

  • @ghanashrim2839
    @ghanashrim2839 Рік тому

    This is the best I've seen anyone explain the problem. Thank you so much yaar.

    • @nikoo28
      @nikoo28  Рік тому

      always happy to have you as my audience :)

  • @curiousmanash8154
    @curiousmanash8154 День тому

    Top notch❤ love you sir keep upload leet code p

  • @anand-zk3uj
    @anand-zk3uj 14 днів тому

    i have watched this vedio today,you asked us to decrease the space complexity of above algorithm.I have found that the operations can be done in same given arra i.e : int len = nums.length;
    if(len == 1)
    return nums[0];
    nums[1] = Math.max(nums[0],nums[1]);
    for(int i = 2; i < len; i++)
    {
    nums[i] = Math.max(nums[i - 2] + nums[i],nums[i - 1]);
    }
    return nums[len - 1];
    By this way we optimise the space.
    Space complexity == O(1)
    Thank you for your Help........

  • @anonymous-ze5fg
    @anonymous-ze5fg Рік тому +1

    Your contents are great, highly appreciated , Please keep uploading more interesting problems.. Thanks

  • @RohitSharma-mg3np
    @RohitSharma-mg3np 7 місяців тому +1

    Subscribed , Nice Explaination

  • @eizinzinlin1261
    @eizinzinlin1261 Місяць тому

    Very clean explanation, Thank you

  • @rajeshpaithari7320
    @rajeshpaithari7320 5 місяців тому

    Great logic and great explanation! Expecting more videos.

  • @unknownman1
    @unknownman1 9 місяців тому +1

    No words. Simply wow!!!

    • @nikoo28
      @nikoo28  9 місяців тому +1

      your comment - "just looking like a wow"..thanks for the support.

  • @daffapradana8557
    @daffapradana8557 Рік тому

    The best explanation that i have ever found! thank u so much

  • @kamalasowmya7120
    @kamalasowmya7120 7 місяців тому +1

    thank you for breaking this down! :)

  • @gojosatoru988
    @gojosatoru988 Рік тому +1

    Very to understand explanation, Loved it.

  • @AndyBnq
    @AndyBnq 3 місяці тому

    I swear, you are awfully underrated man, as opposed to Neetcode who are so overrated. No offence to Neetcode.
    Everytime I don't understand an explanation from Neetcode (which is almost always the case from problem 10 onwards in Neetcode Blind 75), I always come to you and you never let me down.

    • @nikoo28
      @nikoo28  3 місяці тому

      everyone has their own style of teaching, and everyone understands differently. Whatever helps you!! 😄
      Glad I am able to help you out. You can help by sharing and subscribing 😄

  • @ramswrooppatidar7599
    @ramswrooppatidar7599 7 місяців тому +1

    wow just a amazing , explaination great work

  • @user-fk2xu3fh5r
    @user-fk2xu3fh5r 9 місяців тому

    Brother thank you so much 🥺❤ now I understand after you drawing those pictures

  • @quickfeet7778
    @quickfeet7778 9 місяців тому

    interesting, i've been solving dp problems which only use recursion, so I assumed that dp generally applied only to recursive solutions, its good to see it used in a different way, thanks!

    • @nikoo28
      @nikoo28  8 місяців тому

      Every recursive problem has an iterative solution..and I usually prefer those..recursive code is super hard to read

  • @yusef_01
    @yusef_01 Місяць тому

    Excellent explanation, thank you

  • @sudhanshukushwaha6351
    @sudhanshukushwaha6351 10 місяців тому +1

    masterpiece

  • @AkashReddy-e6j
    @AkashReddy-e6j 2 місяці тому

    one that stood out 🔥🔥

  • @leonardocavalcanti1225
    @leonardocavalcanti1225 Місяць тому

    Excelente explicação!
    Muito obrigado!

  • @user-ll5qj9tj5c
    @user-ll5qj9tj5c Місяць тому

    u earned my respect

  • @badrinarayanans355
    @badrinarayanans355 8 місяців тому +1

    Clearly explained, thankyou.

  • @jus3472
    @jus3472 7 місяців тому +1

    Great explanation thank you.

  • @adityamaurya554
    @adityamaurya554 5 місяців тому

    ek no bhai

  • @puneetchhabra2578
    @puneetchhabra2578 Рік тому

    Thankyou sir!!
    Great Explaination, beginners friendly.

  • @abhisheknandann
    @abhisheknandann Рік тому +1

    Great video boss!

  • @YashRekha594
    @YashRekha594 9 місяців тому

    Thank you very much for the well-explained video 👍

  • @khyatikakkar9259
    @khyatikakkar9259 3 місяці тому

    Amazing explanation !!

  • @makethemostOfwhatYouGot
    @makethemostOfwhatYouGot 4 місяці тому

    Incredible stuff !

  • @mukeshperiyasamy3364
    @mukeshperiyasamy3364 Рік тому

    Great explanation, Thank you for sharing your knowledge.

  • @sruthisri-t4l
    @sruthisri-t4l 8 днів тому

    can you explain 139)word break problem in leetcode

  • @rogerthat7190
    @rogerthat7190 Рік тому +1

    Thank you!!

  • @fagunraythatha5601
    @fagunraythatha5601 Рік тому

    Hey buddy, I have been coding fgr a while, I use your videos as my revision. You are great brother, can you bring a series of hard algorithm with dynamic programming solution

    • @nikoo28
      @nikoo28  Рік тому +1

      for sure, i am planning to bring in all the hard problems as well. just need some time to build up the basics. I will start on those hard problems by the end of the year.

  • @hydrocy.9165
    @hydrocy.9165 7 днів тому

    8+4 should be 12 instead of 11??

  • @candichiu7850
    @candichiu7850 Рік тому +2

    The best on UA-cam!

    • @nikoo28
      @nikoo28  Рік тому +1

      So heartwarming to hear that :)

  • @jayprajapati9
    @jayprajapati9 Рік тому +1

    best explanation

  • @rambhaktuchihaobito7987
    @rambhaktuchihaobito7987 Рік тому

    sir the way u teach...... is so good ❣❣

    • @nikoo28
      @nikoo28  Рік тому +1

      Thank you so much 😀

  • @ganesang7217
    @ganesang7217 8 місяців тому +1

    😎 cool

  • @VIJAYGUPTA-fc5hi
    @VIJAYGUPTA-fc5hi Рік тому

    bro according to base case you provided what if arraylength ==0 and you are trying to access arr[0], is that not con concerning ??

  • @tanvirazad49
    @tanvirazad49 4 місяці тому

    thank you 🎉

  • @jishnus1526
    @jishnus1526 10 місяців тому

    Excellent explanation 🤩

  • @kunalkheeva
    @kunalkheeva Рік тому

    it really helped bro!

  • @akshitjain2906
    @akshitjain2906 Рік тому +1

    legend bro legend

  • @beingstudent5571
    @beingstudent5571 2 місяці тому

    I think the way you explain is tabulation not memoization btw very excellent explanation .

    • @nikoo28
      @nikoo28  2 місяці тому

      tabulation is a way of memoization.

  • @subee128
    @subee128 8 місяців тому

    Thanks

  • @504rishukumar4
    @504rishukumar4 7 місяців тому

    Nice Explanation,

  • @lo_sten
    @lo_sten Місяць тому

    how to return the houses he robbed?

  • @prashanthshetty8337
    @prashanthshetty8337 6 місяців тому +1

    func rob(nums []int) int {
    if len(nums) == 1 {
    return nums[0]
    }
    if len(nums) == 2 {
    return max(nums[0], nums[1])
    }
    a := nums[0]
    b := max(nums[0], nums[1])
    for i := 2; i < len(nums); i++ {
    a, b = b, max(a + nums[i], b)
    }
    return b
    }

  • @mock1112
    @mock1112 Рік тому

    Amazing video

  • @pranitagawas4806
    @pranitagawas4806 8 місяців тому

    Please provide the solution to the paint fence problem

    • @nikoo28
      @nikoo28  7 місяців тому

      i don't have access to the problem. Can you provide me an alternate link

  • @romanporter6331
    @romanporter6331 7 місяців тому

    спасибо, очень классно всё объясняешь. Я смотрел тебя с автоматическим кривым переводом через нейросеть и всё равно всё понял)

    • @nikoo28
      @nikoo28  7 місяців тому

      Я так рада, что смогла вам помочь.

  • @aswanthnarayanan
    @aswanthnarayanan Рік тому +1

    Please make a video about Git

    • @nikoo28
      @nikoo28  Рік тому +2

      that is a good suggestion. I will start preparing something on it. :)

  • @AmritSingh-du7pq
    @AmritSingh-du7pq Рік тому

    Hello Bhaiya, Can you please make a video on Check If It Is a Good Array leetcode (1250).

    • @nikoo28
      @nikoo28  Рік тому

      i will add it to my queue and get a video out sometime...but to be honest..this is not a good problem to solve...doesn't actually test your logical or data structure skills.

  • @AdityaAgrawal-fi7np
    @AdityaAgrawal-fi7np 7 днів тому

    2 baar stiver deka nahi aaya saimaj eak barr lohia deka all test case pass

  • @bhavindhobi79
    @bhavindhobi79 7 місяців тому

    how can i find the houses that i robbed??

    • @nikoo28
      @nikoo28  7 місяців тому

      start with the total loot at each index. with respect to the house you choose, store those results

  • @minnikeswarrao6185
    @minnikeswarrao6185 Рік тому

    Sir any source to learn dynamic programming?

    • @nikoo28
      @nikoo28  Рік тому +3

      Not to give you false hopes…but there is no source…the more you practice the more easily you will be able to identify patterns. Things will start to get a little comfortable day by day :)

  • @Ayush_kumar_1013
    @Ayush_kumar_1013 7 місяців тому

    fail test case 1,2,3,1

    • @nikoo28
      @nikoo28  7 місяців тому +1

      1,2,3,1 does give the answer as 4, which is correct. What answer do you expect ?

  • @pramanayagam
    @pramanayagam Рік тому

    Bro what about input as [2,1,1,2]

    • @nikoo28
      @nikoo28  Рік тому +1

      The output should be 4. First house and the last house.

    • @nikoo28
      @nikoo28  Рік тому +1

      The above method will output as 4. My solution is based on the method and it gives a correct answer. Can you explain your thought process?

    • @pramanayagam
      @pramanayagam Рік тому

      @@nikoo28 Ok bro