Dsa
Hashing
Easy
Flavor Profile Clusterer
In a culinary database, every ingredient has a 'flavor profile'—a set of taste tags. Two ingredients are considered 'taste-identical' if they have the exact same set of tags, regardless of the order they are listed in. Your task is to process a list of ingredients and their tags, and identify the name of the ingredient that belongs to the largest group of taste-identical ingredients. If multiple groups share the same maximum size, return the ingredient name from those groups that comes first alphabetically.
Example:
Input:
3
Salt
salty mineral
SeaSalt
mineral salty
Pepper
spicy
Output: Salt (Because Salt and SeaSalt both have {salty, mineral}, forming a group of 2. Salt < SeaSalt alphabetically).
Key concepts
hashinggroupingsets
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now