Someone help with this?

  • 0

    class Solution(object):
    def change(self, amount, coins):
    :type amount: int
    :type coins: List[int]
    :rtype: int
    count = 0
    self.dfs(amount, count, coins, 0, [])
    return count

    def dfs(self, amount, count, coins, index, path):
        if (amount == 0):
            count += 1
        if (amount < 0):
        for i in xrange(index, len(coins)):
            self.dfs(amount - coins[i], count, coins, index, path + [coins[i]])

    I am kinda basing this off of 39. Combination Sum since these general questions have this approach, but I am not quite sure what I am doing wrong.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.