easy

Climbing Stairs

You climb a staircase of n steps, taking either one or two steps at a time. Count the number of distinct ways to reach the top.

Constraints
  • 1 ≤ n ≤ 45
Examples
in: n = 3
out: 3
1+1+1, 1+2, 2+1.

Code it yourself

Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?

Choose an approach to check your pattern recognition, or reveal the discussion when you need help.