FastPrepWays to Climb n Stairs
Problems/Ways to Climb n Stairs

Ways to Climb n Stairs

Adobe logoAdobe● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This problem counts the ways to climb a staircase of n steps when each move climbs 1 or 2 steps. An entry (a copy of a review, December 2023, no offer) from a senior candidate for a test automation role in India lists a staircase question under its common short name. It was the first of two coding tasks in the first round, which came before a round on testing. The entry gives only that name. We read it as the usual version with moves of 1 or 2 steps. The entry states no move sizes, limits or examples.

Our choices: moves of 1 or 2 steps, and the order of moves matters. n is from 1 to 90. The answer is a 64-bit integer. It passes 2^53 from n = 78, so JavaScript needs BigInt. The examples are new.

Our version is about 80% the same as the reported question.

A staircase has n steps. Each move climbs either 1 step or 2 steps. Return the number of different move sequences that end exactly on the top step.

Two sequences are different if they differ in at least one move, so 1 + 2 and 2 + 1 count separately. The answer grows fast: return it as a 64-bit integer (in JavaScript, return a BigInt once it can pass 2^53).

Function

climbWays(n: int) → long

Examples

Example 1

n = 5return = 8

The 8 ways are 1+1+1+1+1, 2+1+1+1, 1+2+1+1, 1+1+2+1, 1+1+1+2, 2+2+1, 2+1+2 and 1+2+2.

Example 2

n = 1return = 1

A single step can only be climbed one way: one move of 1 step.

Example 3

n = 50return = 20365011074

The count grows fast: 20365011074 ways, more than a 32-bit integer can hold.

Constraints

  • 1 <= n <= 90
  • The answer fits in a signed 64-bit integer.

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • 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
  • Climbing StairsGoogle · PHONE SCREENGoogle interview questions
  • Count Routes Through a City GridIMC Trading · PHONE SCREENIMC Trading interview questions
  • Climbing StairsBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Climbing StairsExpedia · PHONE SCREEN · ONSITE INTERVIEWExpedia interview questions
  • Fibonacci Number with Constant Extra SpaceZipRecruiter · PHONE SCREENZipRecruiter interview questions
  • The Nth Number in the Fibonacci SequenceCapital One · PHONE SCREEN · ONSITE INTERVIEWCapital One interview questions

Interview reports that mention this question

  • Adobe Frontend and QA Interviews: 14 Experiences (Part 6 of 6)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public long climbWays(int n) {
        // Write your code here.
    }
}
Checking account…