Leetcode 721. Accounts Merge
Given lists of accounts where each account has a name and emails, merge accounts that share any email by grouping connected emails (e.g., via union-find or graph traversal) and return each person's name with their sorted unique emails. Note names alone don't imply same person — connectivity is determined solely by shared email addresses.
Asked at:
Meta
Airbnb
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late March, 2026
Meta
Senior
Mid February, 2026
Airbnb
Senior
Same as leetcode. Variation - 1. Account is an object instead of just email. So it can have multiple fields like name, email, Phone number. 2. Emails are case insensitive so need to take that into account. abc@xyz.com and AbC@xyz.com are same and need to be merged. 2. follow up - Accounts should be merged if phone numbers match as well. Example - Account 1 - name - Alice email - abc@xyz.com ph - 12345 Account 2 - Bob email - abc@xyz.com ph - 9999 Account 3 - Bob email - bob@xyz.com ph - 999 Account 3 - Cat name - abc email - a2@xyz.com ph - 12345 All three should be merged since Account 1 email = Account 2 email account 2 phone number = account 3 phone number
Late October, 2025
Meta
Senior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.