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.
That represents "n choose k" where n is b[j] and k is 2.
https://en.wikipedia.org/wiki/Combination
If b[j] is 5 , it's 5 * 4 / 2, or 10
which is the same as
len(list(combinations([1] * 5, 2)))
You can also find more info on this by looking around for "binomial coefficients".
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Anagrams
You are viewing a single comment's thread. Return to all comments →
That represents "n choose k" where n is b[j] and k is 2. https://en.wikipedia.org/wiki/Combination If b[j] is 5 , it's 5 * 4 / 2, or 10 which is the same as len(list(combinations([1] * 5, 2)))
You can also find more info on this by looking around for "binomial coefficients".