Dsa
Hashing
Warm-up
Friend Group Identifier
You need to identify groups of friends based on their names. The input consists of names, where each name is followed by a list of names who they consider friends, all on the same line. The end of input is indicated by an empty line. You should output each name and their unique group of friends. Example input:
Alice: Bob, Charlie
Bob: Alice, David
Charlie: Alice
Output should format each person and their friends:
Alice: Bob, Charlie
Bob: Alice, David
Charlie: Alice
Key concepts
hashingdictionariesgrouping
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