Climbing Stairs

00:00
EasyDynamic ProgrammingFibonacci
AmazonGoogleAdobe

Count distinct ways to climb n stairs where you can take 1 or 2 steps at a time.

Examples

Input → n=2
Output → 2
Note: 1+1 or 2
Input → n=3
Output → 3
Note: 1+1+1, 1+2, 2+1
Input → n=5
Output → 8
Input → n=1
Output → 1