Stairs

You are climbing a stair case. It takes n steps to reach to the top.

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Example :

Input : 3
Return : 3

Steps : [1 1 1], [1 2], [2 1]

Interview Code Editor
Hints
  • Solution Approach
  • Complete Solution
4911 successful submissions.
Asked In:
  • Morgan Stanley
  • Amazon
  • Intel
Click here to jump start your coding interview preparation