From ff8ca6a710dc39c603cbcb0513cd82c108cf4377 Mon Sep 17 00:00:00 2001 From: rl544 <111494264+rl544@users.noreply.github.com> Date: Sat, 21 Jan 2023 14:45:49 +0900 Subject: [PATCH] =?UTF-8?q?uploaded=20at=202023.=201.=2021.=20=EC=98=A4?= =?UTF-8?q?=ED=9B=84=202:45:48?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- programmers/2 x n 타일링/solution.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 programmers/2 x n 타일링/solution.java diff --git a/programmers/2 x n 타일링/solution.java b/programmers/2 x n 타일링/solution.java new file mode 100644 index 0000000..edb571e --- /dev/null +++ b/programmers/2 x n 타일링/solution.java @@ -0,0 +1,15 @@ +// [문제 링크]: https://school.programmers.co.kr/learn/courses/30/lessons/12900 + +class Solution { + public int solution(int n) { + int[] ans = new int[n+1]; + for(int a = 0; a <= n; a++){ + int tmp = 0; + if(a == 0) tmp = 1; + if(a >= 1) tmp += ans[a-1]; + if(a >= 2) tmp += ans[a-2]; + ans[a] = tmp%1000000007; + } + return ans[n]; + } +} \ No newline at end of file