Number of Ways to Paint N × 3 Grid LeetCode solution in Python
1class Solution:2def numOfWays(self, n: int) -> int:3two_c_options = 64tot_options = 125for i in range(n - 1):6temp = tot_options7tot_options = (two_c_options * 5) + ((tot_options - two_c_options) * 4)8two_c_options = (two_c_options * 3) + ((temp - two_c_options) * 2)9tot_options = tot_options % (1000000007)10return tot_options