Skip to content

Instantly share code, notes, and snippets.

@supcik
Last active April 16, 2018 13:52
Show Gist options
  • Save supcik/1324e8c160a842f65c6a20b2a54eb5d9 to your computer and use it in GitHub Desktop.
Save supcik/1324e8c160a842f65c6a20b2a54eb5d9 to your computer and use it in GitHub Desktop.
class RecursiveChangeMaker():
def __init__(self, total, coins):
self.total = total
self.coins = coins
def solve(self):
def recSolver(total):
if total == 0: return 0
return min([1 + recSolver(total-c) for c in self.coins if c <= total])
return recSolver(self.total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment