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.
See VamsiSangam's answer for the formula that the 'double parentheses' notation is referring to.
importmath# Complete the solve function below.defsolve(n,m):P=10**9+7m=m-1num=math.factorial(n+m)%Pden=math.factorial(n)*math.factorial(m)den=pow(den,P-2,P)return((num*den)%P)
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 →
You may be really unhappy trying to figure this out by yourself, but mathematicians have already done so for you.
If I'm not mistaken. It's an example of what they call a k-multicombination. There are similar such formulas for counting different kinds of problems.
https://en.wikipedia.org/wiki/Combination#Number_of_combinations_with_repetition
See VamsiSangam's answer for the formula that the 'double parentheses' notation is referring to.