递归 求该青蛙跳上一个n级的台阶总共有多少种跳法

跳台阶

http://www.nowcoder.com/questionTerminal/8c82a5b80378478f9484d87d1c5f12a4

 
public int JumpFloor(int target) { if(target <= 0) return 0; if(target == 1) return 1; if(target == 2) return 2; int one = 1; int two = 2; int result = 0; for(int i = 2; i < target; i++){
        result = one+ two;
        one = two;
        two = result;
    } return result;
}
全部评论

相关推荐

10-22 12:34
测试工程师
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务