Coins problem greedy

will greedy always work for indian rupees but not for other set of rupees?? why??

@shampblocks greedy always work for indian coins understand it with a example
34 - you take 20 then 10 then 2 2 . the arrangement of coins is such that greedy works
now consider different system 1 7 10 and you want to make 15 so it req 7 7 1 3 coins so greedy fails

i hope its cleared if yes dont forget to mark the doubt as resolved @shampblocks

yess this things understood and i have done that but what is the core idea which separate the indian coins from other set of coins?? this is my doubt

indian coins system is ordered u can see somewhat like powers of 2 uniformly increasing
1 2 5 10 20 50 100 … so its always best to take the largest value @shampblocks

when i am approaching any problem what could be the procedure to go with greedy or dp?? this is the simple question so we can understand but in some question dont even realise will greedy work or not??

yeah there is no other way to check if greedy works or not. you have to take examples and see and after taking 2 3 you will understand so its always better to take contradiction try to fail greedy @shampblocks

1 Like

is it ok? any more doubts? @shampblocks

ohk bhaiya thanks…

ok np just mark it resolved then @shampblocks

ok done…

hmm still showing your doubt maybe will be reflected after some time

yess i think so…