class Solution {
public:
int jumpFloorII(int number) {
if(number == 1 || number == 2)
return number;
else
return 2 * jumpFloorII(number - 1);
}
};
剑指offer:变态跳台阶
最新推荐文章于 2020-09-06 16:24:20 发布
class Solution {
public:
int jumpFloorII(int number) {
if(number == 1 || number == 2)
return number;
else
return 2 * jumpFloorII(number - 1);
}
};