Climbing a staircase
CodeChefOpen on judge ↗
Given a step ladder of K steps. In how many different ways can you get to the top? Each time you can move up by one step OR two steps. # Example 1 ###Input: 2 ###Output: 2 ###Explanation: There are two ways to climb to the top. - 1 step + 1 step - 2 steps # Example 2 ###Input: 3 ###Output: 3 ###Explanation: There are three ways to climb to the top. - 1 step + 1 step + 1 step - 1 step + 2 steps
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