Cody

Problem 628. Book Club

A book club that has K members, as a group, have to read N books. Return how many different ways the members could read the books. All of the books must be read by at least one member of the group and all of the members must read one and only one book.

For Example, for K = 3 and N = 2, there are 6 ways

  1. Member 1 reads book 1, Member 2 reads book 1, Member 3 reads book 2
  2. Member 1 reads book 1, Member 2 reads book 2, Member 3 reads book 1
  3. Member 1 reads book 1, Member 2 reads book 2, Member 3 reads book 2
  4. Member 1 reads book 2, Member 2 reads book 1, Member 3 reads book 1
  5. Member 1 reads book 2, Member 2 reads book 1, Member 3 reads book 2
  6. Member 1 reads book 2, Member 2 reads book 2, Member 3 reads book 1

Note: all of the test cases use small values of n and k to allow for brute-force solutions.

Solution Stats

36.84% Correct | 63.16% Incorrect
Last Solution submitted on Dec 29, 2018

Problem Comments