FastPrepClimbing Stairs
Problems/Climbing Stairs

Climbing Stairs

AMD logoAMD● EasyFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: Two reports name Climbing Stairs, and one specifies moves of one or two steps. Zero behavior, bounds and the callable interface are authored; approximate source match 95%.

A staircase has n steps. Each move climbs either one or two steps. Return the number of ordered move sequences that reach the top exactly.

For zero steps, count the empty sequence as one way.

Function

climbStairs(n: int) → int

Examples

Example 1

n = 2return = 2

The two sequences are [1,1] and [2].

Example 2

n = 3return = 3

The three sequences are [1,1,1], [1,2] and [2,1].

Constraints

  • 0 <= n <= 45.

More AMD problems

  • Insert After a Linked-List NodeONSITE INTERVIEW · Seen Oct 2026
  • LRU CacheONSITE INTERVIEW · Seen Oct 2026
  • Lowest Common Ancestor of a Binary TreePHONE SCREEN · Seen Oct 2026
All AMD interview questionsSee AMD hiring insights
Saved
public int climbStairs(int n) {
    // Write your code here.
}
Checking account…