gomez-Izr

Programming challenge.

Implement a program USING TAIL RECURSION that will answer the following question: Your inputs are a non-negative int representing a sum of money and an array of positive ints representing possible coin denominations. You need to tell how many different ways of producing the given sum of money using given denominations are. For example given 4 and (1,2), the answer is 3 (2+2, 2+1+1, 1+1+1+1)

I have a solution, but it is not tail-recursive...
If anyone cares, the preferred language for this case is Scala, but I'm more interested in the algorithm.
I'll screen the comments just to keep it interesting.
Here's my NON-tail-recursive solution:

I am removing full text of solution from publicly-accessible post and moving it to friends-only to comply with Coursera policy.