top of page

Staircase Interview Question Asked In Google.

Writer's picture: Lokendra VedLokendra Ved

Updated: May 17, 2020

Problem Statement:

Suppose there is a staircase that you can climb in either 1 step, 2 steps, or 3 steps. In how many possible ways can you climb the staircase if the staircase has n steps? Write a recursive function to solve the problem.


Example:


n = 3

Output = 4

The output is 4 because there are four ways we can climb the staircase:


1. 1 step + 1 step + 1 step

2. 1 step + 2 steps

3. 2 steps + 1 step

4. 3 steps

Find the solution Here

Note: try to solve it with recursion.

Follow Programmers Door for more.

61 views0 comments

Recent Posts

See All

Comentarios


bottom of page