# LeetCode: Climbing Stairs Solution

*Memoized recursion*

## Implementation

1var climbStairs = function (n, memo = {}) {2 if (n < 0) return 03 if (n <= 1) return 14 if (memo[n] !== undefined) return memo[n]5 return (memo[n] = climbStairs(n - 1, memo) + climbStairs(n - 2, memo))6}

## References

## Comments

Loading comments...

## Tags

leetcode

recursion

dynamic programming

## Apply and earn a $2,500 bonus once you're hired on your first job!

Clients from the Fortune 500 to Silicon Valley startups

Choose your own rate, get paid on time

From hourly, part-time, to full-time positions

Flexible remote working environment

A lot of open JavaScript jobs!!

**Fact corner:** Referred talent are 5x more likely to pass the Toptal screening process than the average applicant.

**Still hesitate?** Read HoningJS author's guide on dealing with Toptal interview process.

## Next Post

LeetCode: Binary Tree Right Side View

Feb 6, 2021