Coin Change - Leetcode 322 - Dynamic Programming (Python)

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

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

  • @GregHogg
    @GregHogg  4 месяца назад +1

    Master Data Structures & Algorithms For FREE at AlgoMap.io!

  • @dp8jl
    @dp8jl 6 дней назад

    Used to think this is a backtracking question 😂 and failed multiple times, thanks for a great explanation

  • @ibraheem_Zain
    @ibraheem_Zain 5 месяцев назад +7

    That was clear as sun and helpful even if you use python.
    Thanks sir you are awesome 👍😎❤

    • @GregHogg
      @GregHogg  5 месяцев назад +1

      Awesome super glad it was helpful 😊

  • @tarilonte
    @tarilonte 3 месяца назад

    Your explanation is cristal clear! Thanks a lot for this great video!

  • @Alex-tm5hr
    @Alex-tm5hr 4 месяца назад +2

    Great job, imo better than neetcode's solution for the draw out part

  • @internick_
    @internick_ 2 месяца назад +1

    Why did we have to sort the coins in ascending order?
    Not sure why it becomes an issue if we always consider every coin, still

    • @AI_STORY_JJANG
      @AI_STORY_JJANG Месяц назад

      I also don't think we need sorting

    • @arnobchowdhury9641
      @arnobchowdhury9641 24 дня назад

      Sorting is important for breaking out of the loop early. Check line 15 and 16.

  • @darshandani1
    @darshandani1 3 месяца назад

    Great explanation ! Thanks !

  • @mansurischanov3204
    @mansurischanov3204 4 месяца назад

    thanks dude, this makes so much sense now!

    • @GregHogg
      @GregHogg  4 месяца назад

      Glad to hear it, this is a tricky one!

  • @new-anointingaremu3597
    @new-anointingaremu3597 5 месяцев назад

    This explanation is great thanks a lot

    • @GregHogg
      @GregHogg  5 месяцев назад

      Awesome happy to hear it!

  • @ayushdey5342
    @ayushdey5342 5 месяцев назад +1

    what is the name of the blackboard app that you use to draw stuff? its really good looking

    • @GregHogg
      @GregHogg  5 месяцев назад +1

      Yes it's awesome. It's miro

  • @carefree_ladka
    @carefree_ladka Месяц назад

    Sorting is O(NlogN). Why didn't we consider this in time complexity?

    • @ArtyomKonoplya
      @ArtyomKonoplya Месяц назад +1

      cause len(coins) way too smaller than amount value

  • @Krish-hk1bt
    @Krish-hk1bt Месяц назад

    hei, you are saying "smallest number of ways to make a coin" , isn't it the "minimum number of coins"?

  • @astronautgamer34
    @astronautgamer34 5 месяцев назад +1

    plz explain coin change two it so hard for me to understand

    • @GregHogg
      @GregHogg  5 месяцев назад +1

      I haven't solved this, I'll have to take a look at some point :)

  • @adesopekingsley9967
    @adesopekingsley9967 5 месяцев назад

    I was thinking 🤔
    We can sort reverse the list then pick the biggest number at index 0 then check if its greater than amount if false, then next but if true subtract from amount index. Check if result is present in the list [can use a set] if flase then call recursion using to repeat using result
    Example amount 12
    List=[1,4,5]
    List.sort(reverse=True)
    12>5.. therefore 12-5= 7
    7 not in list and greater than 5
    7>5 therefore 7-5=2
    2

    • @贪财
      @贪财 5 месяцев назад

      $4x3 =$12. So fewest is 3 coins. 5+5+1+1 is 4coins. it cover most but edge

    • @CGS9_
      @CGS9_ 5 месяцев назад

      @@贪财 always those edge cases that will get ya