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
Master Data Structures & Algorithms For FREE at AlgoMap.io!
Thanks, that was really good explanation. After watching your tutorials I also started actively using Paint when solving leetcode
That was clear as sun and helpful even if you use python.
Thanks sir you are awesome 👍😎❤
Awesome super glad it was helpful 😊
Thanks for great explanation ! I like your smile !
Your explanation is cristal clear! Thanks a lot for this great video!
Used to think this is a backtracking question 😂 and failed multiple times, thanks for a great explanation
Great job, imo better than neetcode's solution for the draw out part
Yay!
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
I also don't think we need sorting
Sorting is important for breaking out of the loop early. Check line 15 and 16.
Great explanation ! Thanks !
thanks dude, this makes so much sense now!
Glad to hear it, this is a tricky one!
what is the name of the blackboard app that you use to draw stuff? its really good looking
Yes it's awesome. It's miro
This explanation is great thanks a lot
Awesome happy to hear it!
Sorting is O(NlogN). Why didn't we consider this in time complexity?
cause len(coins) way too smaller than amount value
hei, you are saying "smallest number of ways to make a coin" , isn't it the "minimum number of coins"?
plz explain coin change two it so hard for me to understand
I haven't solved this, I'll have to take a look at some point :)
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
$4x3 =$12. So fewest is 3 coins. 5+5+1+1 is 4coins. it cover most but edge
@@贪财 always those edge cases that will get ya