Created
January 11, 2020 23:51
-
-
Save konstantinvlasenko/7793f212818ba7d8825d4df4de5cb4e9 to your computer and use it in GitHub Desktop.
Climbing Stairs
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
/** | |
* @param {number} n | |
* @return {number} | |
*/ | |
let stack = {}; | |
var climbStairs = function(n) { | |
if (n > 1) | |
return stack[n] || ( stack[n] = climbStairs(n - 1) + climbStairs(n - 2)) | |
return 1; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment