Open cjql opened 4 years ago
https://leetcode.com/problems/number-of-ways-to-paint-n-3-grid/submissions/
class Solution: def numOfWays(self, n: int) -> int: a123,a121,mod = 6,6,10**9+7 for i in range(n-1): a123,a121 = a121*2+a123*2,a121*3+a123*2 return (a123+a121) % mod
https://leetcode.com/problems/number-of-ways-to-paint-n-3-grid/submissions/
C++
Java
Python
C
C
JavaScript
Ruby
Swift
Go
Scala
Kotlin
Rust
PHP