题解 | #矩形覆盖#
矩形覆盖
https://www.nowcoder.com/practice/72a5a919508a4251859fb2cfb987a0e6
class Solution { public: int rectCover(int n) { if (n == 0 || n == 1 || n == 2) return n; int a = 1; int b = 2; int sum; for (int i = 3; i <= n; ++i) { sum = a + b; a = b; b = sum; } return sum; } };
2023-剑指-DP 文章被收录于专栏
2023-剑指-DP