Skip to content

Latest commit

 

History

History

challenge-15

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Unique ways to climb a staircase

This problem was asked by Amazon.

Description

There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time.

Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters.

Examples

Input:  
  n: 4
  output: 5

  Output explanation:
    - 1, 1, 1, 1
    - 2, 1, 1
    - 1, 2, 1
    - 1, 1, 2
    - 2, 2