Skip to content

Commit 7c3aa10

Browse files
iamAntimPalAntim-IWPIamShiwangi
committed
Update 790. Domino and Tromino Tiling.py
Co-Authored-By: Antim-IWP <203163676+Antim-IWP@users.noreply.github.com> Co-Authored-By: Shiwangi Srivastava <174641070+IamShiwangi@users.noreply.github.com>
1 parent 0d6b449 commit 7c3aa10

File tree

1 file changed

+12
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)