Climb Stairs with One or Two Steps
Updated
Problem statement
Return the number of ordered sequences of moves that climb exactly n stairs. Each move climbs one or two stairs. Different move orders count separately. There is one way to climb zero stairs: make no moves. Return the exact count without a modulus.
Function
climbWays(n: int) → longExamples
Example 1
n = 3return = 3The sequences are 1,1,1; 1,2; and 2,1.
Example 2
n = 0return = 1The empty sequence is the one zero-step way.
Constraints
- For this exercise, assume 0 <= n <= 91, so the result fits a signed 64-bit integer.
More Intuit Online Assessment questions
- Employee Promotion OpportunitiesOA · Seen Oct 2026
- Next Pascal Row CoefficientOA · Seen Oct 2026
- Parse Router LogsOA · Seen Oct 2026
- Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
- Maximum Square-Free DivisorOA · Seen Oct 2026
- Two Tribes from Taller-Person CountsOA · Seen Oct 2026
- Shortest Path from an Encoded GraphOA · Seen Sep 2026
- Oldest and Youngest EmployeesOA · Seen Sep 2026
- Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
- Submask Sum QueriesOA · Seen Sep 2026
Similar questions at other companies
- Enough Muffins for the LineSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Count Numbers with Digit SumCisco · OACisco interview questions
- Find an Entry of Pascal’s TriangleMorgan Stanley · OAMorgan Stanley interview questions
- Count Lucky TicketsThe D.E. Shaw Group · OAThe D.E. Shaw Group interview questions
- Maximum Signal Walk in a Server TreeTower Research Capital · OA
- Maximum Score with Prime JumpsMicrosoft · OAMicrosoft interview questions
- Jump Game with Prime-3 StepsUber · OAUber interview questions
- Profitable Currency Exchange CycleOptiver · OAOptiver interview questions
- Count Valid A-B-C Sequences Under a Modulo-Four RuleInfosys · OAInfosys interview questions
- Unique Paths Through a GridPeopleStrong · OAPeopleStrong interview questions