This file contains 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
function change(n, coins){ | |
let combos = new Array(n+1).fill(0); | |
combos[0]= 1; | |
for (let coin of coins){ | |
for (let i=1; i<=n; i++){ | |
if(i >= coin){ | |
combos[i] += combos[i-coin] | |
} | |
} | |
console.log('coin', coin) |
This file contains 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
function change(amount, coins, idx) { | |
if (idx >= coins.length -1) return 1; | |
let coin = coins[idx]; | |
let combos = 0; | |
for (let i=0; i * coin <= amount; i++){ | |
let amountRemaining = amount - i * coin; | |
console.log('i',i) | |
console.log('coin', coin) | |
console.log('remaining', amountRemaining) | |
combos += change(amountRemaining, coins, idx + 1); |
This file contains 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
function change(amount, coins, idx, map = new Array(amount+1).fill(0)){ | |
if(map[amount][idx] > 0){ | |
return map[amount][idx]; | |
} | |
if (idx >= coins.length - 1) return 1; | |
let coin = coins[idx]; | |
let combos = 0; | |
for (let i=0; i* coin <= amount; i++){ | |
let amountRemaining = amount - i * coin; | |
combos += change(amountRemaining, coins, idx + 1, map); |
This file contains 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
# Alex Sobiloff | |
## Software Engineer | |
### Skills | |
- Javascript | |
- React | |
- React-Redux | |
- React Native | |
- NodeJS | |
- ExpressJS |