From 53f2f37c6573dd29923a5741ec76a43428ccd3b3 Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Sun, 31 Aug 2025 23:00:53 +0900 Subject: [PATCH] =?UTF-8?q?[20250831]=20PGM=20/=20LV3=20/=20=EB=93=B1?= =?UTF-8?q?=EA=B5=A3=EA=B8=B8=20/=20=EA=B9=80=EC=88=98=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3 \353\223\261\352\265\243\352\270\270.md" | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "suyeun84/202508/31 PGM LV3 \353\223\261\352\265\243\352\270\270.md" diff --git "a/suyeun84/202508/31 PGM LV3 \353\223\261\352\265\243\352\270\270.md" "b/suyeun84/202508/31 PGM LV3 \353\223\261\352\265\243\352\270\270.md" new file mode 100644 index 00000000..3927b6cb --- /dev/null +++ "b/suyeun84/202508/31 PGM LV3 \353\223\261\352\265\243\352\270\270.md" @@ -0,0 +1,26 @@ +```java +class Solution { + public int solution(int m, int n, int[][] puddles) { + int answer = 0; + int[][] dp = new int[n+1][m+1]; + dp[1][1] = 1; + for (int[] temp : puddles) { + dp[temp[1]][temp[0]] = -1; + } + for (int i = 1; i < n+1; i++) { + for (int j = 1; j < m+1; j++) { + if (i == 1 && j == 1) continue; + if (dp[i][j] == -1) continue; + + if (dp[i][j-1] > 0) { + dp[i][j] = (dp[i][j] + dp[i][j-1]) % 1000000007; + } + if (dp[i-1][j] > 0) { + dp[i][j] = (dp[i][j] + dp[i-1][j]) % 1000000007; + } + } + } + return dp[n][m]; + } +} +```