Universal search across Courses, Lessons, Skills, Projects, Challenges, Competitions, Jobs, Internships, and Users
def coinChange(coins, amount):
dp = [float('inf')] * (amount + 1)
dp[0] = 0
for i in range(1, amount + 1):
for c in coins:
if i >= c:
dp[i] = min(dp[i], dp[i - c] + 1)
return dp[amount] if dp[amount] != float('inf') else -1Compute the minimum coins needed to make 11 and print 'MIN_COINS: 3'.