Problem
You climb a staircase that has n steps. In each move, you climb 1 step or 2 steps.
Return the number of different ways to reach the top. Two ways are different when their sequences of moves are different.
Example 1
- Input:
- n = 4
- Output:
- 5
- Explanation:
- The 5 ways are
1+1+1+1,1+1+2,1+2+1,2+1+1and2+2.
Example 2
- Input:
- n = 1
- Output:
- 1
- Explanation:
- The only way is one move of 1 step.
Example 3
- Input:
- n = 6
- Output:
- 13
Constraints
- 1 <= n <= 45
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- Number of Music Playlists
Coding · Combinatorics · Dynamic Programming · Math
- Word Break
Coding · Array · Brute-Force Search · Dynamic Programming
- Word Break II
Coding · Array · Backtracking · Dynamic Programming
- Add Binary
Coding · Bit Manipulation · Math · Simulation
Sources · 2 references
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 70. Climbing Stairs
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source
LeetCode company tags · 9 records
Bloomberg
Climbing Stairs
Reported date not specified · Source window: 6mo
Source snapshot: Oct 20, 2026
Source frequency score: 69.8. This is not an interview probability.
View sourceGoogle
Climbing Stairs
Reported date not specified · Source window: 30d
Source snapshot: Oct 20, 2026
Source frequency score: 53.4. This is not an interview probability.
View sourceGoogle
Climbing Stairs
Reported date not specified · Source window: 3mo
Source snapshot: Oct 20, 2026