Merge Prospect Records Arriving From SMS, Email and Web Chat

Last updated: November 29, 2026

Quick Overview

Each inbound contact has an id and a list of raw identifiers (phone numbers in assorted formats, email addresses). Group contacts that refer to the same prospect, where two contacts are the same person if they share any normalized identifier, directly or transitively.

EliseAI
Coding & Algorithms
Software Engineer
EliseAI
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Each inbound contact has an id and a list of raw identifiers (phone numbers in assorted formats, email addresses). Group contacts that refer to the same prospect, where two contacts are the same person if they share any normalized identifier, directly or transitively.

A prospect might text one number, fill out a listing-site form with an email, then call the leasing line, and the assistant should see one conversation. The interviewer looks for normalization discipline plus union-find for transitive merging.

What the Interviewer Expects
  • Normalize phones (strip punctuation, drop leading country code 1) and lowercase emails
  • Recognize transitive merging and pick union-find or graph BFS
  • Ignore junk identifiers instead of merging on them
  • Return deterministic grouped output
  • Discuss false merges such as shared family phones
Key Topics to Cover
union-find
normalization
entity resolution
hashing
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you stop a property's own office number, pasted into a form, from merging hundreds of prospects?
  • Records arrive as a stream: how do you support online merges and later splits?
  • How would you store this in a database for lookups at message ingest time?
  • What changes if identity is a probability rather than an exact match?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: list of (contact_id, [raw identifiers]). Output: groups of contact ids, each group one prospect. Same prospect means a chain of shared normalized identifiers. Unparseable identifiers ("n/a", ...

High-Level Design

Map every normalized identifier to the first contact that owned it. When a later contact presents the same key, union the two contacts. Union-find with path compression makes each union near constant ...


Submit Your Answer
Markdown supported

Related Questions