House Robber Problem using Dynamic programming | leetcode

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ก.ย. 2024
  • Joey'sTech brings you an exciting dynamic programming problem in this video - the House robber problem.
    The different thing which I have done in this video of dynamic programming tutorial is I have explained this problem using two methods.
    Both the methods suggested in this video follow the dynamic programming approach.
    The only difference between both the approaches is the time complexity of the first method is O(n^2) while the time complexity of the second method is
    O(n).
    Why I have provided both the dynamic programming methods is because doing a single DP problem using 2 different solutions is going to help develop
    your skills of solving DP problems.
    -------------- Problem Statement ------------------
    A robber is roaming in a neighborhood in which there are a few houses along a street.
    The residents of the houses have gone out to see a movie because of which all the houses are deserted.
    Each house has got some cash stashed.
    The robber is looking forward to stealing the cash from the houses.
    But, the robber can't steal from two adjacent houses because if he does so, then it will trigger an alarm which will call the police.
    Your job is to find the maximum cash that the house robber can steal without triggering the alarm.
    The cash stashed will be given in an array.
    The size of the array will denote the number of houses on the street.
    You have to remember that the house robber can't steal the cash from two houses next to each other.
    --------------- Also Watch ------------------------
    Minimum cost of tickets using dynamic programming
    • Minimum cost of ticket...
    Coin game winner where every player has 2 choices (DP)
    • Coin game winner where...
    Unique paths in a grid with obstacles
    • Unique paths in a grid...
    Find if N people can vote on 2 machines
    • Find if N people can v...
    Partition problem using dynamic programming
    • Learn Partition proble...

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

  • @siddharthb2226
    @siddharthb2226 3 ปีที่แล้ว

    Next level!!! Have you uploaded Hosue robber 2 as well?

    • @joeystechpluscode
      @joeystechpluscode  3 ปีที่แล้ว

      Hello Siddharth, so glad that you appreciated this video..will work on it.

    • @siddharthb2226
      @siddharthb2226 3 ปีที่แล้ว

      @@joeystechpluscode big fan of your DP videos 😃

  • @AnkitSingh-tm5dp
    @AnkitSingh-tm5dp ปีที่แล้ว

    🔥🔥