Skip to main content

Practice · 2 of 5

Counting Stairs

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** Count the ways to climb n stairs taking 1 or 2 steps at a time, modulo 10^9 + 7. **Input:** One line: n (1 <= n <= 100000). **Output:** One integer — the number of ways mod 10^9 + 7. **Example:** 3 -> 3 (1+1+1, 1+2, 2+1).

Back to lesson: Practice: Dynamic Programming Problem Set