coin change

coin-change

    what is wrong with this coin-change solution?
	class Solution:
def coinChange(self, coins, amount: int) -> int:
    coins.sort()
    total = 0
    for i in coins:
        total += amount // i
        amount = amount % i
        #print (i, total, amount)
        if amount == 0:
            break
    return total

    
    
Comments (3)