Question
A staircase has steps numbered 1 through n, and you start on the ground (position 0). Each move climbs 1 or 2 steps. Some steps are broken and cannot be landed on; their numbers are given in the list broken (all values are between 1 and n, no duplicates). Return the number of distinct ways to reach step n exactly without ever landing on a broken step. If step n itself is broken, return 0.
count_safe_paths(n: int, broken: list[int]) → int[5,[]]out8[5,[3]]out2State 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.