Quiz: Greedy 3 - coin change

Can greedy be used to find the minimum number of notes to make 1000 from (1,5, 7 ) rupee notes?

Why is the answer to this no?

@kartik.k.saxena greedy can only be used for 1,2,5,10 etc
For 1,3,5,7 and other currencies you have to use DP

For 1000, we take 142 coins of 7, 1 coin of 5 and 1 coin of 1. How is greedy approach not working for this case?

@kartik.k.saxena you dont know if greedy will work for each and every case, but you can be sure of that if you use the DP method.

I’m not saying that greedy algorithm will work for each and every case. What I’m saying is that if I have to make a change of Rs.1000 with [1,5,7] then Greedy will work. And that is what’s been asked in the question.

@kartik.k.saxena greedy will not work with1,5,7 for every value, but yes it is giving correct answer for 1000

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.