Skip to content
DeepForgeby svx
All problems
EasyProbabilitypr-321

Multinomial Coefficient Value

Problem

The multinomial coefficient counts ways to split n distinct items into labeled groups of sizes k1, k2, ...: n! / (k1! k2! ...).

Given n and the group sizes (which sum to n), return the coefficient.

Hint

Divide the total permutations by the internal permutations of each group.

Test cases

case 1
in: [5,[2,3]]
expected: 10
case 2
in: [6,[2,2,2]]
expected: 90
case 3
in: [4,[4]]
expected: 1
Starter codePython
def multinomial_coefficient_value(n, parts):
    # Your code here
    pass

3 test cases · run your code against them in the editor