Re: [algogeeks] Re: POSTAGE STAMP PROBLEM

2012-06-20 Thread Sourabh Singh
try this : similar problem http://www.spoj.pl/problems/NOCHANGE/ On Tue, Jun 19, 2012 at 1:32 PM, aditya gupta adityagupta...@gmail.com wrote: this can be solved in a manner similar to knapsack problem. u can take the weight of tha knapsack the be the the various amounts u need to make, 13

[algogeeks] Re: POSTAGE STAMP PROBLEM

2012-06-20 Thread atul007
isnt it is similar to coin change problem , here we need minimum number of stamps to form a value. so we can check which number exceed the min stamp range i.e 1 to 3. On Jun 19, 11:55 am, sanjay pandey sanjaypandey...@gmail.com wrote: The postage stamp problem is a mathematical riddle that asks

Re: [algogeeks] Re: POSTAGE STAMP PROBLEM

2012-06-20 Thread sanjay pandey
@atul if range is high den complexity wud be much larger... -- 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

[algogeeks] Re: POSTAGE STAMP PROBLEM

2012-06-19 Thread rammar
This can be done with DP. Take an array with values 1 to n. For every number i, try to make it using the stamps available and the 1 to i-1 array. Anytime u find that the upper bound is reached, u return. sudo code. stamps[K]; - Stamp denominations available. a[N] - Array of

Re: [algogeeks] Re: POSTAGE STAMP PROBLEM

2012-06-19 Thread aditya gupta
this can be solved in a manner similar to knapsack problem. u can take the weight of tha knapsack the be the the various amounts u need to make, 13 cents etc etc. we would need to find a first empty cell. instead of parameter value, use your own parameter specifying the number of stamps used. and