def change(self, amount, coins):
:type amount: int
:type coins: List[int]
count = 0
self.dfs(amount, count, coins, 0, )
def dfs(self, amount, count, coins, index, path): if (amount == 0): count += 1 if (amount < 0): return 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.