```
class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
pre = [1, 2]
if n<3:
return pre[n-1]
i=3
while(i<=n):
temp = pre[0]
pre[0]=pre[1]
pre[1] = temp+pre[0]
i=i+1
return pre[-1]
```