프로그래머스/LV2
[프로그래머스 Lv2, python] - 3 x n 타일링
chyam_eun
2025. 5. 12. 18:01
https://school.programmers.co.kr/learn/courses/30/lessons/12902
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
def solution(n):
answer = [0,3,11] # 0, 2, 4일때
index = n//2
if n % 2 != 0: # 홀수 안됨
return 0
if index < 3:
return answer[index] # 이미 있어서
for i in range(3, index+1):
answer.append((3*answer[i-1]+sum(answer[1:i-1])*2+2)%1000000007)
return answer[index]