Safehouse Access

The mastermind’s safehouse is at the top of a towering staircase. The only way to reach the safehouse is by climbing the stairs, and the guards have set a rule: you can climb either 1 or 2 steps at a time. Determine how many distinct ways you can climb to the top.

Input is denoted by an integer n, the total number of steps in the staircase.

  • Each step can be taken as a single step or as part of a double step.
  • The output should be the total number of distinct ways to climb to the top. For example, for n = 4, there are 5 distinct ways to climb: (1+1+1+1), (1+2+1), (2+1+1), (1+1+2), (2+2).


Case 1

Input: n = 5


Case 2

Input: n = 25


Case 3

Input: n = 1000

Submit Here