Loading
Loading
A maintenance ladder has a number of rungs. On each move a technician climbs either one rung or two.
Return how many distinct sequences of moves reach rung n exactly.
n = 41+1+1+1route 11+1+2route 21+2+1route 32+1+1route 42+2route 55Sign in to keep a note here. It is free, and nobody else can see it.
Sign inExample 1
Example 2
1+1 and 2.
Example 3
Sign in to open hints.
Struggling is where the learning happens. Open this once you have genuinely tried, or once the hints have run out.
O(n) time · O(1) space
Input. Run your code to watch it work on this input, one line at a time.
Running code is turned off on this deployment. You can still read the problem, write code, use hints and the visualizer.
Tab moves focus out of the editor. Press Ctrl+M to let Tab indent instead.
No results yet
Run your code against the sample tests, or submit to run the full suite.
Exactly one way to stand still: take no moves.