Coding - Algo/python
[프로그래머스] 등굣길 (python 파이썬)
jainn
2021. 7. 17. 20:31
728x90
문제
https://programmers.co.kr/learn/courses/30/lessons/42898
풀이 및 소스코드
def solution(m, n, puddles):
answer = 0
dp = [[0 for _ in range(m+1)] for _ in range(n+1)]
dp[1][1] = 1
for i in range(1, n+1):
for j in range(1, m+1):
if i==1 and j==1:
continue
elif [j, i] in puddles:
dp[i][j] = 0
else:
dp[i][j] = dp[i-1][j]+dp[i][j-1]
answer = dp[-1][-1]
return answer%1000000007
반응형