Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Coin change
fun coinChange(n, coins)
dp=[]// n+1 items
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
You can’t perform that action at this time.