Problems > Climbing the Staircase > Editorial

Climbing the Staircase — Solution & Editorial

Back to the Problem

ways(n) = ways(n−1) + ways(n−2) — Fibonacci in disguise; iterate with two variables.

Complexity: O(N)