Skip to content

Instantly share code, notes, and snippets.

@Arieg419
Created December 27, 2016 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arieg419/5a88d6a399c7a76303514ed2e870ffa6 to your computer and use it in GitHub Desktop.
Save Arieg419/5a88d6a399c7a76303514ed2e870ffa6 to your computer and use it in GitHub Desktop.
function waysToReturnChange(denominations, numOfCoins, amount) {
if(amount === 0) return 1; // Perfect!
if(amount < 0) return 0; // No solution exists for negative amount
if(numOfCoins < 0 && amount > 0) return 0; // We don't have coins left!
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment