Dsa
Recursion
Easy
Count Ways to Climb Stairs
You are climbing a staircase with N steps. You can take either 1 step or 2 steps at a time. Write a function to determine how many distinct ways you can climb to the top of the staircase. The input will be a single integer N. The output should be a single integer representing the number of ways to climb the staircase. For example:
Input:
4
Output:
5
Key concepts
recursiondynamic programmingfibonacci
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now