Merge Guest Profiles Linked by Shared Emails or Phone Numbers
Last updated: November 29, 2026
Quick Overview
Given guest profiles from different Disney systems, each with an id and a list of identifiers such as emails and phone numbers, group together all profiles that share an identifier directly or through a chain, and return the groups sorted.
Disney
November 29, 20260
0
0 solved
Given guest profiles from different Disney systems, each with an id and a list of identifiers such as emails and phone numbers, group together all profiles that share an identifier directly or through a chain, and return the groups sorted.
An onsite question in the style of Disney's guest identity teams, who unify profiles from Disney+, park tickets, resort bookings and shopDisney under one Disney account. The interviewer checks union-find, normalization of identifiers, and handling transitive links.
What the Interviewer Expects
- Recognize the transitive grouping as connected components
- Use union-find with path compression and union by rank
- Normalize identifiers before matching
- Keep profiles with no identifiers as singleton groups
- Compare with a BFS over a bipartite graph
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- A shared family phone wrongly merges two households; how do you prevent over-merging?
- How would you run this on 200 million profiles in a batch job?
- How would you support un-merging when a guest disputes a link?
- Which identifiers should carry more weight than others?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: a list of (profile_id, identifiers). Two profiles belong together if they share any identifier after trimming and lowercasing, and the relation is transitive. Output: sorted groups of sorted ...
High-Level Design
Treat each profile as a node. Keep a map from normalized identifier to the first profile that owned it. When a later profile has the same identifier, union the two. After all unions, profiles with the...