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]

NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Stairs on Interview Code Editor
Sign Up
to access hints and editorial solutions for Stairs
8491 successful submissions.
Asked In:
  • Morgan Stanley
  • Amazon
  • Intel
Click here to start solving coding interview questions