Skip to content

Instantly share code, notes, and snippets.

@georgemarshall
georgemarshall / coin_change.py
Created January 12, 2011 22:01
Solve the coin change problem
#!/usr/bin/env python
# encoding: utf-8
def change(value, denominations=[0.25, 0.10, 0.05, 0.01]):
change = {}
for denomination in denominations:
change[denomination] = 0
while value - denomination >= 0:
change[denomination] += 1