Dynamic Programming, Programming, Algorithms, Data, Coding Interviews.
(n-1)th stair by taking 1 step or from (n-2)th stair by taking 2 steps. So total number of ways to reach nth stair = Total number of ways to reach (n-1)th stair + Total number of ways to reach (n-2)th stair. So recurrence relation is: climb(n) = climb(n-1) + climb(n-2), where climb(1) = 1 and