2320. Count Number of Ways to Place Houses
Содержание
class Solution:
def countHousePlacements(self, n: int) -> int:
mod = 10**9 + 7
f = [1] * n
g = [1] * n
for i in range(1, n):
f[i] = g[i - 1]
g[i] = (f[i - 1] + g[i - 1]) % mod
v = f[-1] + g[-1]
return v * v % mod