RosettaCodeData/Task/Count-the-coins/Coco/count-the-coins.coco
2023-07-01 13:44:08 -04: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]