Skip to content

Commit ac35ebd

Browse files
authored
Create 1411. Number of Ways to Paint N × 3 Grid.py
1 parent f5c0147 commit ac35ebd

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution:
2+
def numOfWays(self, n: int) -> int:
3+
MOD = 1_000_000_007
4+
5+
aba = 6
6+
abc = 6
7+
8+
for _ in range(1, n):
9+
aba, abc = (
10+
(aba * 3 + abc * 2) % MOD,
11+
(aba * 2 + abc * 2) % MOD
12+
)
13+
return (aba + abc) % MOD

0 commit comments

Comments
 (0)