Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Very fast O(price) dynamic programming solution in Speedy category for Making Change by swagg010164
def checkio(price, denominations):
try:
dp = [0]*(price + 1)
for k in denominations:
dp[k] = 1
for i in range(1, price + 1):
dp[i] = 1 + min([dp[i - k] for k in denominations if i - k >= 0])
return dp[price]
except IndexError:
return
July 5, 2020
Comments: