You are climbing a staircase. It takes n steps to reach the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
nInput: 2 Output: 2
Input: 3 Output: 3
Input: 5 Output: 8
Your program must print a single integer — the number of distinct ways.
No submissions yet.
Discuss dynamic programming, Fibonacci relation, and space optimization.