You can use a trivial dynamic programming for this.

Let W(n) be the number of ways to create n rupees,
then W(n) = W(n-1) + W(n-5) + W(n-10) + W(n-25) + W(n-50)
if(n<0) then W(n) = 0
if(n==0) then W(n) = 1

What do you think would be the complexity of this solution?

On Sat, Sep 10, 2011 at 10:57 AM, teja bala <pawanjalsa.t...@gmail.com> wrote:
>  There are set of coins of {50,25,10,5,1} paise in a box.Write a
> program to find the number of ways a 1 rupee can be created by
> grouping the paise.
>
>
>
> post ur code.............
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/algogeeks?hl=en.
>
>



-- 
Gaurav Menghani

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to