LeetCode: https://leetcode.com/problems/climbing-stairs/
You are climbing a staircase. It takes n steps to reach the top. Each time you can climb either 1 or 2 steps. Return how many distinct ways you can climb to the top.
1
0
2
1
n=5
a=1
b=2
Step 1 / 5
Step 1:
Use dp[n]=dp[n-1]+dp[n-2]. For n=5, initialize a=dp[1]=1 and b=dp[2]=2.
Pointers: i=2
Focus: select @ [0, 1]
n=5a=1b=2