剑指OFFER----面试题10- II. 青蛙跳台阶问题
链接:https://leetcode-cn.com/problems/qing-wa-tiao-tai-jie-wen-ti-lcof/
代码:
class Solution { public: int numWays(int n) { std::vector<int> vec = {1, 1}; for(int i = 2; i <= n; i++){ vec.push_back((vec[i-2] + vec[i-1])%1000000007); } return vec[n]; } };