We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
# Enter your code here. Read input from STDIN. Print output to STDOUTimportsyssys.setrecursionlimit(5000)deffindpath(n,m,seen):if(n,m)inseen:return(seen[(n,m)]%(7+10**9))ifn==0orm==0:return(1)else:seen[(n,m)]=(findpath(n-1,m,seen)+findpath(n,m-1,seen))%(7+10**9)return(seen[(n,m)])seen={(0,0):1}findpath(500,500,seen)fora0inrange(int(input())):n,m=list(map(int,input().split()))print(seen[(n,m)])
for a0 in range(int(input())):
n, m =list(map(int, input().split()))
print(seen[(n, m)])****
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Project Euler #15: Lattice paths
You are viewing a single comment's thread. Return to all comments →
passed all test cases
for a0 in range(int(input())): n, m =list(map(int, input().split())) print(seen[(n, m)])****