def coinChange(self, coins: List[int], amount: int) -> int:
    if (amount < 1):
        return 0
    memo = {}

    def helper(coins, amount):
        if (amount in memo):
            return memo[amount]
        if (amount == 0):
            return 0
        dp = float('inf')
        for coin in coins:
            if (coin > amount):
                continue
            dp = min((helper(coins, (amount - coin)) + 1), dp)
        memo[amount] = dp
        return dp
    helper(coins, amount)
    return ((- 1) if (memo[amount] == float('inf')) else memo[amount])
def coinChange(self, coins: List[int], amount: int) -> int:
    if (amount < 1):
        return 0
    memo = {}

    def helper(coins, amount):
        if (amount in memo):
            return memo[amount]
        if (amount == 0):
            return 0
        dp = float('inf')
        for coin in coins:
            if (coin > amount):
                continue
            dp = min((helper(coins, (amount - coin)) + 1), dp)
        memo[amount] = dp
        return dp
    helper(coins, amount)
    return ((- 1) if (memo[amount] == float('inf')) else memo[amount])