Created
June 20, 2018 10:28
-
-
Save elitenomad/ae9b5def5932cf585b9f2ff1136935bd to your computer and use it in GitHub Desktop.
factorial with Memoization
This file contains hidden or 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
const factorialRecursiveWithMemoization = (n) => { | |
const multiplyer = (ender) => { | |
if(ender == 1){ | |
return ender; | |
}else{ | |
return (ender * multiplyer(ender - 1)) | |
} | |
} | |
return multiplyer(n); | |
} | |
const factorialRecursiveMemoization = factorialRecursiveWithMemoization(1); | |
console.log(`What is factorialRecursiveMemoization ${factorialRecursiveMemoization}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.