Page tree
Skip to end of metadata
Go to start of metadata
class Solution:
    def change(self, amount: int, coins: List[int]) -> int:
        amount_count = amount + 1
        ans = [0] * amount_count
        ans[0] = 1
        for coin in coins:
            for j in range(coin, amount_count):
                ans[j] += ans[j - coin]
        return ans[-1]
  • No labels