Problem
Ask
Submissions

Problem: Climbing Stairs

Medium
30 min
Explore how to use dynamic programming to determine the number of distinct ways to climb a staircase with one or two steps at a time. This lesson helps you understand problem constraints, logical problem-solving, and how to implement an efficient O(n) time solution with O(n) space complexity.

Statement

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

Constraints:

  • 11 \leq n 45\leq 45
Problem
Ask
Submissions

Problem: Climbing Stairs

Medium
30 min
Explore how to use dynamic programming to determine the number of distinct ways to climb a staircase with one or two steps at a time. This lesson helps you understand problem constraints, logical problem-solving, and how to implement an efficient O(n) time solution with O(n) space complexity.

Statement

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

Constraints:

  • 11 \leq n 45\leq 45