Problems

Climbing Stairs

easy
easy
math
dynamic-programming

You are climbing a staircase. It takes n steps to reach the top. Each time you can climb either 1 or 2 steps. In how many distinct ways can you climb to the top?

Examples

Example 1

Input: n = 2
Output: 2

Example 2

Input: n = 3
Output: 3

Example 3

Input: n = 5
Output: 8

Running will execute all 3 cases.