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 solve(n):
ncr = []
for r in range (n//2 + 1):
ncr.append(comb(n, r)%(10**9))
if n % 2== 0:
return ncr + ncr[:-1][::-1]
else:
return ncr + ncr[::-1]
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
nCr table
You are viewing a single comment's thread. Return to all comments →
def solve(n): ncr = [] for r in range (n//2 + 1): ncr.append(comb(n, r)%(10**9)) if n % 2== 0: return ncr + ncr[:-1][::-1] else: return ncr + ncr[::-1]