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.
def fact(a):
p=1
if(a==0):
return p;
else:
while(a!=0):
p = p*a
a = a-1
return p
t = int(input())
for i in range(t):
m,n = map(int,input().strip().split())
print((int(fact(m+n-1)/(fact(m)*fact(n-1))))%(1000000007))
whats wrong in this code?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Permutations
You are viewing a single comment's thread. Return to all comments →
def fact(a): p=1 if(a==0): return p; else: while(a!=0): p = p*a a = a-1 return p t = int(input()) for i in range(t): m,n = map(int,input().strip().split()) print((int(fact(m+n-1)/(fact(m)*fact(n-1))))%(1000000007))
whats wrong in this code?