In one of the interviews, I found the following problem. Please suggest me an algorithm for this. I do not need the code.
- There are a number of
Npossible drinks. (n1, n2 ..) - Has a
Cnumber of regular customers. - Each customer has a fixed favorite set of drinks.
- Bartender must create as few drinks as possible to meet the needs of all customers.
Example:
Cust1: n3,n7,n5,n2,n9
Cust2: n5
Cust3: n2,n3
Cust4: n4
Cust5: n3,n4,n3,n5,n7,n4
Output: 3(n3,n4,n5)
source
share