FastPrepCount Staircase Ways
Problems/Count Staircase Ways

Count Staircase Ways

Goldman Sachs logoGoldman Sachs● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks for the number of ways to climb n stairs when each move takes one or two steps. We added the rule for an empty staircase, input limits, and the function signature. Our version is about 90% the same as the reported question.

A staircase has n steps. Starting before the first step, each move climbs exactly one or two steps.

Return the number of distinct ordered move sequences that land exactly on step n. For n = 0, return 1 for the empty sequence.

Function

countStaircaseWays(n: int) → long

Examples

Example 1

n = 4return = 5

The valid step sequences are 1111, 112, 121, 211, and 22.

Example 2

n = 0return = 1

The empty climb is one valid way.

Constraints

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

More Goldman Sachs Phone Screen questions

  • House Robber IIIPHONE SCREEN · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · Seen Nov 2026
  • Best Average Student ScorePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Check a Complete Binary TreePHONE SCREEN · Seen Oct 2026
  • Meeting RoomsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Is a Power of TenPHONE SCREEN · Seen Oct 2026
  • Minimum Traveling Salesperson TourPHONE SCREEN · Seen Oct 2026
  • Square Root with Newton IterationPHONE SCREEN · Seen Oct 2026
  • First Non-Repeating CharacterPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Root of the Largest TreePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 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
  • Climbing StairsGoogle · PHONE SCREENGoogle interview questions
  • Count Routes Through a City GridIMC Trading · PHONE SCREENIMC Trading interview questions
  • Ways to Climb n StairsAdobe · PHONE SCREENAdobe interview questions
  • Heads in Fair Coin FlipsJane Street · PHONE SCREENJane Street interview questions
  • Climbing StairsBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Climbing StairsExpedia · PHONE SCREEN · ONSITE INTERVIEWExpedia interview questions
  • Cumulative Fibonacci SumZillow · OA · PHONE SCREENZillow interview questions
All Goldman Sachs interview questionsSee Goldman Sachs hiring insights
Saved
class Solution {
    public long countStaircaseWays(int n) {
      // write your code here
    }
}
Checking account…