1. Fibonacci in Disguise Optimal
Intuition
The last move onto step n was either a single step from n-1 or a double from n-2, and those two sets of routes share nothing — so the count is their sum. That is the Fibonacci recurrence, and recognising it is the whole problem. Two rolling variables replace the table, because a step never looks further back than two.
Algorithm
1. One step: one way. Two steps: two ways.
2. Walk upward keeping the counts for the previous two steps.
3. Each step's count is their sum.
Time & Space
Time O(n). Space O(1) with rolling variables; the naive recursion is exponential without memoisation, which is worth saying.