Skip to content

Commit d830150

Browse files
authored
Create solution3.py
1 parent c217992 commit d830150

File tree

1 file changed

+14
-0
lines changed
  • solution/0700-0799/0790.Domino and Tromino Tiling

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution:
2+
def numTilings(self, n: int) -> int:
3+
MOD = 10**9 + 7
4+
if n == 1:
5+
return 1
6+
if n == 2:
7+
return 2
8+
if n == 0:
9+
return 0
10+
dp = [1,1,2]
11+
for i in range(3 , n+1):
12+
value = (dp[i-3] + 2 * dp[i-1]) % MOD
13+
dp.append(value)
14+
return dp[-1]

0 commit comments

Comments
 (0)