Skip to content

Instantly share code, notes, and snippets.

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)
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);
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);
@alexzobi
alexzobi / gist:767766d7e7b72481198bb22add0d178c
Created September 17, 2018 19:11
Fullstack Engineer Resume
# Alex Sobiloff
## Software Engineer
### Skills
- Javascript
- React
- React-Redux
- React Native
- NodeJS
- ExpressJS