Skip to content

Instantly share code, notes, and snippets.

@zestime
Created July 21, 2016 00:36
Show Gist options
  • Select an option

  • Save zestime/464c8d46290a03a6f6b5a486a1f1a1e1 to your computer and use it in GitHub Desktop.

Select an option

Save zestime/464c8d46290a03a6f6b5a486a1f1a1e1 to your computer and use it in GitHub Desktop.

Revisions

  1. zestime created this gist Jul 21, 2016.
    5 changes: 5 additions & 0 deletions countChange.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    function countChange(money, coins) {
    if (money == 0) return 1;
    if (money < 0 || coins.length == 0) return 0;
    return countChange(money - coins[0], coins) + countChange(money, coins.slice(1));
    }