Loading...
The Staircase Problem
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- mid, senior
Problem
Write a function that counts the number of distinct ways to climb to the top of a staircase with n steps. You can take either 1 or 2 steps at a time. For n=3 there are 3 ways: (1+1+1), (1+2), (2+1).
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.