思路如下: eg:如果要跳到10节台阶,先计算出跳到8阶和9阶的
class Solution { public: int jumpFloor(int number) { if(number == 0) return 1; if(number == 1) return 1; return jumpFloor(number-1) + jumpFloor(number-2); } };
class Solution { public: int jumpFloor(int number) { if(number == 0) return 1; if(number == 1) return 1; return jumpFloor(number-1) + jumpFloor(number-2); } };