We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a5f09e commit 22a8d7bCopy full SHA for 22a8d7b
suyeun84/202508/31 PGM LV3 등굣길.md
@@ -0,0 +1,26 @@
1
+```java
2
+class Solution {
3
+ public int solution(int m, int n, int[][] puddles) {
4
+ int answer = 0;
5
+ int[][] dp = new int[n+1][m+1];
6
+ dp[1][1] = 1;
7
+ for (int[] temp : puddles) {
8
+ dp[temp[1]][temp[0]] = -1;
9
+ }
10
+ for (int i = 1; i < n+1; i++) {
11
+ for (int j = 1; j < m+1; j++) {
12
+ if (i == 1 && j == 1) continue;
13
+ if (dp[i][j] == -1) continue;
14
+
15
+ if (dp[i][j-1] > 0) {
16
+ dp[i][j] = (dp[i][j] + dp[i][j-1]) % 1000000007;
17
18
+ if (dp[i-1][j] > 0) {
19
+ dp[i][j] = (dp[i][j] + dp[i-1][j]) % 1000000007;
20
21
22
23
+ return dp[n][m];
24
25
+}
26
+```
0 commit comments