Created
December 27, 2016 15:54
-
-
Save Arieg419/5a88d6a399c7a76303514ed2e870ffa6 to your computer and use it in GitHub Desktop.
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 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