const long long mod = 1e9 + 7;
class Solution {
public:
int numTilings(int n) {
vector<vector<long long>> dp(n + 1, vector<long long>(4));
dp[0][3] = 1;
for (int i = 1; i <= n; i++) {
dp[i][0] = dp[i - 1][3];
dp[i][1] = (dp[i - 1][0] + dp[i - 1][2]) % mod;
dp[i][2] = (dp[i - 1][0] + dp[i - 1][1]) % mod;
dp[i][3] = (dp[i - 1][0] + dp[i - 1][1] + dp[i - 1][2] + dp[i - 1][3]) % mod;
}
return dp[n][3];
}
};
11-18
1321
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-25
254
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-07
258
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-22
203
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-05