Trains the technique from
LeetCode 746Min Cost Climbing 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 crew has to get up and over a service ladder whose rungs each need patching before they will take weight. The array fees holds the patching charge for every rung, counted from the bottom, so fees[i] is billed the moment a climber rests on rung i.
A climber opens the ascent by resting on rung 0 or on rung 1, whichever they prefer, and is billed for that rung. From whatever rung they are on, the next move lifts them one rung or two rungs higher. The ascent is over as soon as a move carries the climber past the highest rung, and clearing the ladder is not billed.
Return the smallest total charge for an ascent that gets past the top.
Example 1
The climber opens on rung 1 and is billed 1, then a two-rung move carries them past rung 2, which is the top of this ladder. Nothing more is billed.
Example 2
Resting on rungs 0, 2 and 4 is billed 1 + 3 + 1 = 5, and one more move from rung 4 clears the ladder.
Example 3
Resting on rung 1 and then rung 2 is billed 3 + 2 = 5, and a two-rung move from rung 2 carries the climber past rung 3.
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 cheapest_rung_climb(fees: list[int]) -> int:public int cheapestRungClimb(int[] fees)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.