FastPrepClimbing Stairs
Problems/Climbing Stairs

Climbing Stairs

Bloomberg LP logoBloomberg LP● EasyNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report directly names a climbing-stairs dynamic-programming question in the Bloomberg new-grad phone screen. This practice version uses the standard one-or-two-step contract.

Given n, the number of steps in a staircase, return how many distinct sequences of moves reach exactly the top.

Each move climbs either 1 step or 2 steps.

Function

climbStairs(n: int) → int

Examples

Example 1

n = 2return = 2

The two valid sequences are 1 + 1 and 2.

Example 2

n = 5return = 8

The last move is one step from step 4 or two steps from step 3. Add the ways to reach each of those steps: 5 + 3 = 8.

Example 3

n = 1return = 1

There is one way to climb one step.

Constraints

  • 1 <= n <= 45.
See Bloomberg LP hiring insights
Saved
class Solution {
    public int climbStairs(int n) {
        // Write your code here.
    }

}
Checking account…