You are viewing a single comment's thread. Return to all comments →
def getWays(n, c): count = [0]*(n+1) count[0] = 1 c.sort(reverse = True) for coin in c: for i in range(coin, n +1): count[i] += count[i-coin] return count[n]
sorting is done in order to understand how denomination is formed
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
The Coin Change Problem
You are viewing a single comment's thread. Return to all comments →
sorting is done in order to understand how denomination is formed