title: "[프로그래머스] 2 x n 타일링 Python 파이썬 해설 (Level 2) - 이도훈"
cleanUrl: "programmers/12900"
description: "프로그래머스 Level 2 문제 [2 x n 타일링]의 풀이를 정리합니다."

문제 설명 및 제한사항

아이디어 및 해결 방법

코드

import sys; sys.setrecursionlimit(1000000)

cache = {1:1, 2:2}

def solve(n):
    if n in cache:
        return cache[n]
    
    v = solve(n-1) + solve(n-2)
    cache[n] = v % 1000000007
    return cache[n]

def solution(n):
    return solve(n)

출처

프로그래머스 코딩테스트 연습 https://school.programmers.co.kr/learn/challenges