Skip to content

Instantly share code, notes, and snippets.

@konstantinvlasenko
Created January 11, 2020 23:51
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 konstantinvlasenko/7793f212818ba7d8825d4df4de5cb4e9 to your computer and use it in GitHub Desktop.
Save konstantinvlasenko/7793f212818ba7d8825d4df4de5cb4e9 to your computer and use it in GitHub Desktop.
Climbing Stairs
/**
* @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