โœ๏ธ

Climbing Stairs

Easy๐Ÿท๏ธ Dynamic programming๐Ÿ“‚ Greedy & Dynamic Programming
๐Ÿงฉ The problem

You can climb 1 or 2 steps at a time. In how many distinct ways can you reach the top of n steps?

Examples

  • 3 โ†’ 3 (1+1+1, 1+2, 2+1)

๐ŸŽฏ Aim for: O(n) time ยท O(1) space

โœ๏ธ Write your solution

Pick a language, press Run to try it, then Run tests to check it against every test case โ€” just like a coding interview.

โ† All practice problems