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
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
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