Climbing Stairs

Easy Solved

Description

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?

Input format / Clarification:

  • Line 1: Integer n

Examples

Input:
2
Output:
2
Input:
3
Output:
3
Input:
5
Output:
8

Note:

Your program must print a single integer — the number of distinct ways.

No submissions yet.

Discuss dynamic programming, Fibonacci relation, and space optimization.

Test Cases