Dungeon Game (LeetCode) | Dynamic Programming Explanation

Поделиться
HTML-код
  • Опубликовано: 5 окт 2024

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

  • @Tiyasa-d8f
    @Tiyasa-d8f 2 месяца назад +1

    the only intuitive video all over you tube! Thanks

  • @nmnjn
    @nmnjn 4 года назад +4

    this is gonna change the game 💪🏻

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

    Very good explaination, I was doing the mistake of going top-down, without thinking that values at i, j depend on the future values.
    Thanks!

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

      Glad I could help! Be sure to subscribe for all the future content! ♥

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

    I have watched all videos there is to watch for this question, but only could understand your code walkthrough; thank you so much :))

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

      I'm really glad you found this video useful! Be sure to subscribe for future content!

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

    gone through 3-4 videos but this was the best explanation. Thank you.

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

    Very nicely explained :D , didn't understand this concept from other videos.
    Also it was nice to see that you have timestamps as well in the video, that helped :)

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

      Thank you so much! I'm glad you found this useful :) Subscribe for more upcoming videos!

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

    Very well explained

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

    Very helpful.. do more such videos❤️❤️

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

      Yes! More content coming up! Be sure to subscribe!

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

    Thanks, excellent explanation

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

    Loved it!

  • @thiccphone1166
    @thiccphone1166 8 месяцев назад

    Why would you want the minimum health at the end?
    I would want maximum health especially if you can carry health over to the next floor. TBH, wasn't really paying attention and you may have explained it but I don't get what you mean by "wasting health" since you aren't technically wasting anything since if the goal is only to reach (2,2) from (0,0) as long as you get to the location then the optimal solution is taking less steps. Since both solutions are equal, except one solution results in having more health at the end, it would be safe to assume that MORE health at the end is better rather than having the minimum.
    Having the maximum health means you will be prepared for the future, while having the minimum means you can only do the single task.
    So if the rule was to get there with the fewest steps, then health is irrelevant outside of being alive upon reaching the destination.
    If the rule was to get there before the princess's health reaches 0, say after every step she loses health and has a number of health points, the optimal solution would be to get as much health for the knight as possible and the princess has the minimum required to reach the goal.
    Given that the only rule is to reach the princess without dying then there are two solutions.
    If the question was what's the minimum health required by a knight to reach the princess then the optimal solution is still Down-Down-Right-Right as the minimum health require is 6, not 7.
    At the same time, my knight would be stronger by the time I reach the princess and your knight would be the weakest. My underdog knight could continue adventuring.