4 kyu
Counting Change Combinations
57 of 11,264leakymirror
Description:
Write a function that counts how many different ways you can make change for an amount of money, given an array of coin denominations. For example, there are 3 ways to give change for 4 if you have coins with denomination 1 and 2:
1+1+1+1, 1+1+2, 2+2.
The order of coins does not matter:
1+1+2 == 2+1+1
Also, assume that you have an infinite amount of coins.
Your function should take an amount to change and an array of unique denominations for the coins:
countChange(4, [1,2]) # => 3
countChange(10, [5,2,3]) # => 4
countChange(11, [5,7]) # => 0
Puzzles
Recursion
Similar Kata:
Stats:
Created | Sep 18, 2014 |
Published | Sep 18, 2014 |
Warriors Trained | 42812 |
Total Skips | 11969 |
Total Code Submissions | 55116 |
Total Times Completed | 11264 |
CoffeeScript Completions | 57 |
JavaScript Completions | 3346 |
Python Completions | 4740 |
Haskell Completions | 562 |
Clojure Completions | 174 |
C# Completions | 1193 |
C++ Completions | 762 |
COBOL Completions | 10 |
C Completions | 708 |
D Completions | 9 |
Java Completions | 56 |
Total Stars | 1581 |
% of votes with a positive feedback rating | 91% of 1130 |
Total "Very Satisfied" Votes | 960 |
Total "Somewhat Satisfied" Votes | 146 |
Total "Not Satisfied" Votes | 24 |