Code Room
CodingMediumcod-g1489
Subject Dynamic programming 1dLevel Entry–Mid~14 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.