Created
          November 21, 2012 23:30 
        
      - 
      
 - 
        
Save jbochi/4128535 to your computer and use it in GitHub Desktop.  
    Dá troco
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def change(n, coins): | |
| if n == 0: | |
| return 1 | |
| elif n < 0 or len(coins) == 0: | |
| return 0 | |
| else: | |
| return change(n, coins[1:]) + change(n - coins[0], coins) | |
| print change(10, [10, 5, 2, 1]) | |
| print change(3, [1, 2, .5, 5, 10]) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment