7.19 第一次做,无法 AC
7.20 差一点点,明天再做一次。
7.21 一次 AC
题目描述
原题连接:https://leetcode-cn.com/problems/qing-wa-tiao-tai-jie-wen-ti-lcof/
解题思路:和斐波那契数列差不多,但初值不同
K 神题解:https://leetcode-cn.com/problems/qing-wa-tiao-tai-jie-wen-ti-lcof/solution/
class Solution {public int numWays(int n) {int a = 1, b = 1, sum;for(int i = 0; i < n; i++) {sum = (a + b) % 1000000007;a = b;b = sum;}return a;}}
