Hi, Greedy solution will work only when the denomination of coins are such that they are multiples of the smallest number present (it should be greater than 1)
In dynamic programming we check all possible combination. and improve the runtime by storing results in tables/arrays we can save a lot of computation. Here- Generate all possible combination of numbers, allowing repetition and suppose you say 'nCr' then 'r' running from 1 to n. On Mar 3, 11:54 pm, "mukesh tiwari" <[EMAIL PROTECTED]> wrote: > hi everybody ..i am stuck on a problem ..i need ur help.. > problem is that i have k coins(v1,v2,v3......vk) and money S . and i have to > find out that whether it is possible or not to make the money S using the > given coins...firstly i was using greedy but it failed on some inputs > ..like we have 2 coins of (3 and 5) and i have to exchange 11 . > so using greedy fiirstly i take 5 since it is less than 11 so i have to > again take 5 and sum becomes 10 . So using greedy it gives it not possible > but if use onr coin of 5 and two coin of 3 then it is possible .. > so plz help me dynamic programming experts.. > limits are k<100 and S<50000 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---