题解 | #跳台阶#
跳台阶
http://www.nowcoder.com/practice/8c82a5b80378478f9484d87d1c5f12a4
# -*- coding:utf-8 -*- class Solution: def jumpFloor(self, number): # write code here n = number if n <=2: return n dp_1 = 1 dp_2 = 2 for i in range(3, n+1): dp = dp_1 + dp_2 dp_1 = dp_2 dp_2 = dp return dp