Code RoomStaircase no double steps
MediumPrep Room Coding #692

Staircase no double steps

CodingAlgorithms & data structuresEntry–Mid~14 min

You climb a staircase of n steps using moves of 1 or 2 steps. A 2-step move is tiring, so you may never make two 2-step moves in a row — every 2-step must be followed by a 1-step (or be the final move). Return the number of distinct move sequences that end exactly on step n. For n = 0 return 1. For example, n = 4 has 4 sequences: 1111, 112, 121, 211 (22 is forbidden).

Implement
count_paced_climbs(n: int) → int
Examples
in[4]out4
in[5]out6
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 14 min
InputExpectedGot
[4]4not run yetsample
[5]6not run yetsample