Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 628. Book Club

Created by @bmtran

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.

Tags

Problem Group

Solution Statistics

10 correct solutions 34 incorrect solutions
Last solution submitted on May 26, 2013

Problem Comments