Prateek Bhaiya says greedy approach will fail here

Why Greedy Approach will fail for Coin Change problem?

take a example coin set (1,7,10) and we have to make 15
greedy approach ans - 10+1+1+1+1+1 = 6 coins
while ans is 7+7+1 = 3 coins
@rssrivastavarohan

i hope your doubt is cleared if yes dont forget to mark your doubt resolved @rssrivastavarohan

Vatsal bro can you please look me for this : what is the error already I have defined vector class
Questions is : Next Greater Element

ok wait some time let me take a look @rssrivastavarohan

hey can you send the question link too

@rssrivastavarohan i have removed the error but your logic is wrong it will always give -1 for all in the output https://ide.codingblocks.com/s/235372

bro this is the questions link:

i have corrected the error see above ur approach is wrong dry run your code @rssrivastavarohan

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.