Ledge climb sequences
In a platformer game, your character climbs a tower of n ledges starting from the ground (ledge 0). Each dash move ascends exactly 1, 2, or 3 ledges. Return the number of distinct sequences of dash moves that land the character exactly on ledge n. If n is 0 the character is already at the top, so return 1. For example, n = 3 has 4 sequences: 1+1+1, 1+2, 2+1, and 3.
Implement
count_dash_routes(n: int) → intExamples
in
[3]out4in
[5]out13What 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 10 min
solution.py
InputExpectedGot
[3]4not run yetsample[5]13not run yetsample