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

33.33% Correct | 66.67% Incorrect
Last solution submitted on Jul 14, 2015

Problem Comments

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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more