blob: 0cdf363df5f4f127010edba6a6ef8d24eab23c89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
│ You are given a positive integer N which represents the number of steps
│ in a staircase. You can either climb 1 or 2 steps at a time. Write a
│ function that returns the number of unique ways to climb the stairs.
│def staircase(n):
│ # Fill this in.
│
│print staircase(4)
│# 5
│print staircase(5)
│# 8
│
│ Can you find a solution in O(n) time?
|