algos_and_structures/neetcode/recursion/climbing_stairs
2025-02-19 21:11:55 +03:00
..
README.md Add soltuion for neetcode: staircase 2025-02-19 21:11:55 +03:00
solution.py Add soltuion for neetcode: staircase 2025-02-19 21:11:55 +03:00

You are given an integer n representing the number of steps to reach the top of a staircase. You can climb with either 1 or 2 steps at a time.

Return the number of distinct ways to climb to the top of the staircase.

Example 1:

Input: n = 2

Output: 2 Explanation:

1 + 1 = 2 2 = 2 Example 2:

Input: n = 3

Output: 3 Explanation:

1 + 1 + 1 = 3 1 + 2 = 3 2 + 1 = 3 Constraints:

1 <= n <= 30