You are coding as a Guest. Sign in with your RoleNest account to permanently track your streak, earn XP, and climb the Campus Leaderboard!
Sign In with RoleNestProblem Set
🔥Climbing Stairs: Dynamic Step CombinationsEasy
EasyDynamic Programming•Acceptance: 52.8%
Climbing Stairs: Dynamic Step Combinations
Real-World Engineering Context
Fibonacci state transition modeling in CPU instruction pipeline scheduling and branch predictor warm-up cycles.
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?
Sample Test Cases
Input: [2]
Expected: 2
Input: [3]
Expected: 3
Input: [5]
Expected: 8
Input: [1]
Expected: 1
Constraints
- 1 <= n <= 45
Language:
Ready to test. Click Run Code or Submit Solution to run test cases in isolated browser sandbox.