Merge Duplicate Dealership Customer Records by Phone and Email
Last updated: November 29, 2026
Quick Overview
Given customer records that each have an id, a list of phone numbers and a list of emails, group together every record that is connected through a shared normalized phone number or email, directly or transitively.
Tekion
November 29, 20260
0
0 solved
Given customer records that each have an id, a list of phone numbers and a list of emails, group together every record that is connected through a shared normalized phone number or email, directly or transitively.
A dealership's customers show up in sales, service and CRM, often as separate records typed by different staff, and a platform like Tekion that unifies those modules has to resolve identities without merging strangers. The interviewer checks that you see the transitive grouping as connected components, normalize keys carefully, and think about false merges.
What the Interviewer Expects
- Recognizes transitive matches as connected components
- Normalizes phones (strip punctuation, drop leading country code 1) and emails (trim, lowercase)
- Uses union-find or graph BFS keyed by normalized value, not pairwise comparison
- Ignores junk values such as empty or too-short phone numbers
- Discusses the risk of over-merging, such as a shared family or business phone
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 dealer's main line was typed as the phone on 400 records. How do you stop that from collapsing them into one customer?
- How would you do this incrementally as new records arrive instead of in a nightly batch?
- Which record's fields survive a merge, and how do you keep an audit trail so it can be undone?
- How would you add fuzzy name matching without making the job quadratic?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Each record has id, phones, emails. Two records belong together if they share any normalized phone or email; the relation is transitive. Output groups of ids, sorted for determinism. Phones are ...
High-Level Design
Pairwise comparison is O(n^2). Instead, build a map from normalized key to the first record that owned it. When a later record has the same key, union the two records. Union-find with path compression...