题目:http://www.nowcoder.com/practice/8c82a5b80378478f9484d87d1c5f12a4
C++
1 class Solution {2 public:3 int jumpFloor(int n) {4 if (n == 1 || n == 2) return n;5 return jumpFloor(n - 1) + jumpFloor(n - 2);6 }7 };
本文共 285 字,大约阅读时间需要 1 分钟。
题目:http://www.nowcoder.com/practice/8c82a5b80378478f9484d87d1c5f12a4
C++
1 class Solution {2 public:3 int jumpFloor(int n) {4 if (n == 1 || n == 2) return n;5 return jumpFloor(n - 1) + jumpFloor(n - 2);6 }7 };
转载于:https://www.cnblogs.com/CheeseZH/p/5112899.html