Dsa
Dynamic Programming
Easy
Climbing Stairs Variants
You are climbing a staircase with n steps, and you can climb 1, 2, or 3 steps at a time. Write a program to find the number of distinct ways to reach the top of the staircase.
Input Format:
- A single integer n (1 <= n <= 30), the number of steps.
Output Format:
- Print the number of distinct ways to reach the top.
Example:
Input:
4
Output:
7
Key concepts
dynamic_programmingstairsvariants
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