Climbing Stairs
Updated
Problem statement
A staircase has n steps. Starting below the first step, you may climb either one or two steps at a time.
Return the number of different step sequences that reach the top exactly. Sequences with a different order of moves count separately.
Function
climbStairs(n: int) → intExamples
Example 1
n = 2return = 2The sequences are [1,1] and [2].
Example 2
n = 3return = 3The sequences are [1,1,1], [1,2] and [2,1].
Constraints
1 <= n <= 45.
More Expedia Onsite Interview questions
- Scramble StringONSITE INTERVIEW · Seen Sep 2026
- Smallest Sufficient TeamONSITE INTERVIEW · Seen Sep 2026
- Check Anagram Pairs Index by IndexONSITE INTERVIEW · Seen Oct 2025
- Fresh Oranges Left After Rotting StopsONSITE INTERVIEW · Seen Oct 2025
- Longest Increasing SubsequenceONSITE INTERVIEW · Seen Oct 2025
- Lowest Common Ancestor with Repeated and Missing ValuesONSITE INTERVIEW · Seen Oct 2025
- Shortest Substring with Exactly K OnesONSITE INTERVIEW · Seen Oct 2025
- Middle Element of a Linked ListONSITE INTERVIEW · Seen Nov 2024
- Minimum in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Sep 2024
- Mirror Image Binary TreesONSITE INTERVIEW · Seen Sep 2024
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 StairsAmazon · ONSITE INTERVIEW
- Count Staircase WaysGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
- Climbing StairsAMD · ONSITE INTERVIEWAMD interview questions
- Climb Stairs with One, Two, or Three StepsAgoda · ONSITE INTERVIEWAgoda interview questions
- Climbing StairsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Climbing StairsGoogle · PHONE SCREENGoogle interview questions
- Count Routes Through a City GridIMC Trading · PHONE SCREENIMC Trading interview questions
Interview reports that mention this question
- Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
- Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
- Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
- Expedia SWE Intern Final Round: 126 Experiences (Part 1 of 6)
- Expedia New Grad SDE Interviews: 20 Experiences (Part 1 of 3)