Skip to content

Instantly share code, notes, and snippets.

@christopherwxyz
Created August 24, 2022 19:45
Show Gist options
  • Save christopherwxyz/72dcae7dde20a620c20b3547b9f747dd to your computer and use it in GitHub Desktop.
Save christopherwxyz/72dcae7dde20a620c20b3547b9f747dd to your computer and use it in GitHub Desktop.

Revisions

  1. Christopher Wallace created this gist Aug 24, 2022.
    11 changes: 11 additions & 0 deletions answer.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    function solution(coins, quantity) {
    let s = new Set([0]);
    for (let i in coins) {
    for (let entry of [...s]) {
    for (let j = quantity[i]; j; ) {
    s.add(coins[i] * j-- + entry);
    }
    }
    }
    return s.size - 1;
    }