Trains the technique from
LeetCode 70Climbing StairsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A maintenance robot waits on the ground under a ladder whose rungs are numbered 1 through n, counting upward from the bottom. Each pull of its winch raises the robot by exactly one rung or by exactly two rungs, and it never lowers itself. The job is finished the moment the robot stands on rung n, and it must not overshoot that rung.
Two climbs are counted separately when their lists of pull sizes differ at some position, so a one-rung pull followed by a two-rung pull is a different climb from a two-rung pull followed by a one-rung pull.
Return how many climbs finish on rung n.
Example 1
A single one-rung pull is the only way up, since a two-rung pull would carry the robot past the top.
Example 2
Writing pulls in order: 1+1+1+1+1, 1+1+1+2, 1+1+2+1, 1+2+1+1, 2+1+1+1, 1+2+2, 2+1+2 and 2+2+1.
Example 3
The climbs that end on rung 7 split into those whose last pull was one rung (13 of them, ending from rung 6) and those whose last pull was two rungs (8 of them, ending from rung 5).
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def ladder_climbs(n: int) -> int:public int ladderClimbs(int n)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.