class Solution:
"""
@param n: An integer
@return: An integer
"""
def climbStairs(self, n):
# write your code here
res = [0, 1, 2]
if n <= 2:
return res[n]
for i in range(3, n+1):
res.append(res[i-1] + res[i-2])
return res[n]
Python, LintCode, 111. 爬楼梯
