Basic idea is, f(n) = f(n-1) + f(n-2). f(1)=1, f(2)=2

```
class Solution(object):
def climbStairs(self, n):
if n==1: return 1
if n==2: return 2
a, b = 1, 2
for i in xrange(2, n):
a, b = b, a + b
return b
```