I'm not even sure what kind of algorithm I need here. Let me describe the problem:
Assume I have a list of values: [1, 3, 3, 8, 19, 23]
And I have six collections:
A = [1, 2, 3, 3, 4, 5]
B = [10, 12, 13, 14, 19, 23]
C = [1, 2, 3, 8, 19, 20, 21, 24]
D = [3, 5, 6, 8, 10, 12, 13, 14]
E = [20, 21, 22, 23, 24, 25, 26]
F = [25, 26, 26, 27, 29, 30]
I want to pick out those values from the collections in a way that I try to pick from the most collections possible. In other words, even though I could obviously pick 1, 3, 3 from collection A, I'd rather pick from A, C, and D. So how do I write an algorithm that maximizes the number of collections that I pick from?