Climbing Stairs
Each position depends on the previous two positions, so keep only the last two counts and build forward iteratively.
Return how many distinct ways there are to reach the top if you can climb 1 or 2 steps at a time.
Each position depends on the previous two positions, so keep only the last two counts and build forward iteratively.
Each position depends on the previous two positions, so keep only the last two counts and build forward iteratively.
Return how many distinct ways there are to reach the top if you can climb 1 or 2 steps at a time.