This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Let's say I have two lists: Actors and Characters. Each list has a length of 9.
Actors: [Actor1, Actor2, Actor3...]
Characters: [Character1, Character2, Character3...]
Each actor also has a preference for the character they want to play.
Example:
Actor1 wants to play Character1, Character2, or Character8
Actor2 wants to play Character4
....
An actor will not get a character that's not in their preferences.
I want to generate all the possible casts, where each actor plays one character. If an actor only has one character as their preference, then they will get that character and none of the casts generated will feature any other actor as that character.
Ideally the final output also won't repeat any casts either.
Pseudocode for an answer is fine, I mostly just need an idea. The complete answer is also fine.
This is a variation of the Exact Cover problem
Subreddit
Post Details
- Posted
- 6 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/algorithms/...