题解 | #跳台阶#
跳台阶
http://www.nowcoder.com/practice/8c82a5b80378478f9484d87d1c5f12a4
递归的做法,简单但是有极大的重复计算。可以采用动态规划简化减少重复计算
public class Solution {
public int jumpFloor(int target) {
if (target <= 2) {
return target;
}
return jumpFloor(target - 1) + jumpFloor(target - 2);
}
}


SHEIN公司福利 995人发布