RosettaCodeData/Task/Count-the-coins/Coco/count-the-coins.coco
2016-12-05 23:44:36 +01:00

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]