题解 | #跳台阶扩展问题# | Rust

跳台阶扩展问题

https://www.nowcoder.com/practice/22243d016f6b47f2a6928b4313c85387

struct Solution{

}

impl Solution {
    fn new() -> Self {
        Solution{}
    }

    /**
    * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
    *
    * 
        * @param number int整型 
        * @return int整型
    */
    pub fn jumpFloorII(&self, number: i32) -> i32 {
        let (mut prefix, mut ans) = (0 as i32, 0 as i32);
        for i in 0..number {
            ans = prefix + 1;
            prefix += ans;
        }
        return ans;
    }
}

全部评论

相关推荐

后来123321:别着急,我学院本大二,投了1100份,两个面试,其中一个还是我去线下招聘会投的简历,有时候这东西也得看运气
点赞 评论 收藏
分享
喜欢喜欢喜欢:这是我见过最长最臭的简历
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务