내 코드
import java.util.*;
class Solution {
public int solution(int m, int n, int[][] puddles) {
int[][] arr = new int[m + 1][n + 1];
arr[0][1] = 1;
for(int i = 0; i< puddles.length; i++){
arr[puddles[i][0]][puddles[i][1]] = -1;
}
for(int i = 1; i <= m; i++){
for(int j = 1; j<= n; j++){
if(arr[i][j] == -1)
arr[i][j] = 0;
else
arr[i][j] = (arr[i-1][j] + arr[i][j-1]) % 1000000007;
}
}
return arr[m][n];
}
}
'코딩테스트 > [프로그래머스] 코딩테스트 연습' 카테고리의 다른 글
구명보트 (0) | 2021.11.23 |
---|---|
조이스틱 (0) | 2021.11.22 |
N으로 표현 (0) | 2021.11.19 |
피로도 (0) | 2021.10.26 |
가장 먼 노드 (0) | 2021.10.22 |