Coin Change - Leetcode 322 - Dynamic Programming (Python)

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

КОМЕНТАРІ • 26

  • @GregHogg
    @GregHogg  4 місяці тому +1

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

  • @ibraheem_Zain
    @ibraheem_Zain 6 місяців тому +7

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

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

      Awesome super glad it was helpful 😊

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

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

  • @dp8jl
    @dp8jl 25 днів тому

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

  • @Alex-tm5hr
    @Alex-tm5hr 5 місяців тому +2

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

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

    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 6 місяців тому

    This explanation is great thanks a lot

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

      Awesome happy to hear it!

  • @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 2 місяці тому

      I also don't think we need sorting

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

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

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

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

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

      Yes it's awesome. It's miro

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

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

    • @ArtyomKonoplya
      @ArtyomKonoplya 2 місяці тому +1

      cause len(coins) way too smaller than amount value

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

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

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

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

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

    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

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

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

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

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

  • @Krish-hk1bt
    @Krish-hk1bt 2 місяці тому

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