99 Elm Problems/Problem 27

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Group the elements of a set into disjoint subsets.27.a) In how many ways can a group of 9 people work in 3 disjoint subgroups of 2, 3 and 4 persons? Write a function that generates all the possibilities and returns them in a list.27.b) Generalize the function to allow group sizes to be specified.

# # # THIS IS A STUB # # #

Example in Elm:
import Html exposing (text)
import List

f : Int -> Int
-- your implementation goes here

main = text (toString (f 0))

Result:

4

Solutions