bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Easy1-D Dynamic ProgrammingLC 70

Climbing Stairs

You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Asked at 20 companies
AdobeAlibabaAmazon
Hints
  • 1.Think about what data structure fits Climbing Stairs
  • 2.Consider the brute force complexity and how to optimize
  • 3.Can you trade space for time?
LeetCodeNeetCode