8 lines
213 B
Text
8 lines
213 B
Text
changes = (amount, coins) ->
|
|
ways = [1].concat [0] * amount
|
|
for coin of coins
|
|
for j from coin to amount
|
|
ways[j] += ways[j - coin]
|
|
ways[amount]
|
|
|
|
console.log changes 100, [1 5 10 25]
|