Staircase
CodeChefOpen on judge ↗
Chef thinks he has put on some weight from eating too much. But it's too difficult for him to be on a diet. So, he decides to take the stairs every time instead of elevators. You’re given a positive integer $N$, which is the number of steps in the staircase. Each time Chef can climb either $a$ or $b$ steps. Chef wonders how many unique ways are there for him to climb the staircase. And so, he
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.
Sign in to chat with the tutor and save your progress.
Sign in to start