Skip to content

Commit c56cee7

Browse files
author
hangyeol
committed
103차 3번 문제풀이
1 parent 3b2cc10 commit c56cee7

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def solution(n):
2+
dp = [0] * (n + 1)
3+
dp[1] = 1
4+
5+
if n >= 2:
6+
dp[2] = 2
7+
8+
# 마지막에 세로로 1개 두는 경우 -> 한 자리가 비워져 있어야 함
9+
# 마지막에 가로로 2개 두는 경우 -> 두 자리가 비워져 있어야 힘
10+
for i in range(3, n + 1):
11+
dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
12+
13+
return dp[n]

0 commit comments

Comments
 (0)