FastPrepClimbing Stairs
Problems/Climbing Stairs

Climbing Stairs

BAMTECH Media logoBAMTECH Media● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The author reports the classic one-or-two-step stair-count task. The report does not provide bounds or the zero-step convention. For this exercise n is from 1 to 45, ordered move sequences are counted, and the result fits a signed 32-bit integer. About 90% of the reported task scope is represented; this is an editorial estimate, not original-code similarity.

Return the number of distinct ordered ways to climb exactly n steps when each move climbs one or two steps. Move order matters: one then two differs from two then one.

Function

climbStairs(n: int) → int

Examples

Example 1

n = 1return = 1

There is one sequence: a single one-step move.

Example 2

n = 4return = 5

The five sequences are 1+1+1+1, 1+1+2, 1+2+1, 2+1+1 and 2+2.

Constraints

  • 1 <= n <= 45
  • Each move climbs exactly one or two steps.

More BAMTECH Media Phone Screen questions

  • Combination SumPHONE SCREEN · Seen Oct 2019
  • Top K Largest Values with Constant Auxiliary SpacePHONE SCREEN · Seen Sep 2019
  • Valid ParenthesesPHONE SCREEN · Seen Sep 2019

Similar questions at other companies

  • Best Time to Buy and Sell StockMeta · PHONE SCREENMeta interview questions
  • Best Time to Buy and Sell StockSwiggy · PHONE SCREEN
  • Biased Coin: Probability of Exactly h HeadsAkuna Capital · PHONE SCREENAkuna Capital interview questions
  • Dice Sum That Is a Multiple of mSusquehanna International Group (SIG) · PHONE SCREENSusquehanna International Group (SIG) interview questions
  • Probability of Consecutive HeadsSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Count Staircase WaysGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
  • Suffix Maximum Frequency QueriesMicrosoft · PHONE SCREENMicrosoft interview questions
  • Best Time to Buy and Sell StockOracle · PHONE SCREEN · ONSITE INTERVIEWOracle interview questions
  • Best Time to Buy and Sell StockJP Morgan Chase · PHONE SCREENJP Morgan Chase interview questions
  • Climbing StairsGoogle · PHONE SCREENGoogle interview questions

Interview reports that mention this question

  • BAMTECH SWE and Data Engineer: 2 Experiences (Part 16 of 18)
See BAMTECH Media hiring insights
Saved
class Solution {
    public int climbStairs(int n) {
        // Write your code here
    }
}
Checking account…