Created
          February 20, 2019 06:38 
        
      - 
      
 - 
        
Save khatv911/780b1cfdf4049dca6efbaafb4b3f59fe to your computer and use it in GitHub Desktop.  
    Coin change
  
        
  
    
      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
    
  
  
    
  | fun coinChange(n, coins) | |
| dp=[]// n+1 items | |
| dp[0]=0 | |
| for i from 1 to n | |
| minCoins = maxint | |
| for(coin in coins) | |
| if(i >= coin) | |
| min = Math.min(min, dp[i -coin]+1) | |
| dp[i] = min | |
| Return dp[n] | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment