← All problemsSign in

03-STAIRS JUMPING

Sam is climbing a staircase. It takes n steps to reach the top. Each time Sam can either climb 1 or 2 steps. In how many distinct ways can he climb to the top? ### Input First line contain single integer which represents no of stairs. ### Output Output also contain single integer which represents how many distinct ways can he climb to the top ### Constraints 1 <= n <= 45 ### Subtasks - **Subt

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start