# Help Needed in a question

I had a placement OLT recently where I was asked the following question as 2nd of 3 questions. As it was campus placement and the time limit was 3 questions in 40 mins. I don’t think the question is something way too difficult but something is just not hitting in the solution. The Question goes on like:
Problem Statement
In a certain pub, a lazy bartender serves drinks to costumers.
Each customer has a set of drinks he likes and would be satisfied only if he gets one of those.
What is the least number of distinct drinks bartender has to prepare to make all consumers happy.
Input
First-line contains an integer N, the total number of drinks available.
Second-line contains an integer C, the total number of costumers.
next C-lines for each of ith costumer contain:

1. an integer c[i][0] for total number drinks the customer likes
2. next c[i][0] integers are the list of drinks the customer likes.

Constraints
1 \leq N \leq 1000

1 \leq C \leq 10000
PS the test is over and I am asking the question in sheer curiosity and just to learn for other tests coming up.

Create hash map/table drink as index and customer as data and create array of customer .
Check one by one how many customer likes that drink. If customer array full then visited drink is the ans of this question.
Edit- Here is you question- https://careercup.com/question?id=5672092990177280

1 Like

The answer can be multipe drinks, like it might be a case that at least k different drinks are needed to make all the customers happy. I don’t think it would work on cases like that. I might be wrong, you can explain it in that case