Record Linkage Part 1 - Directly Linked Records
Updated
Problem statement
You are given user records and must decide which records are linked to a target record using weighted field similarity.
Inputs:
rows: aString[]where each entry is"id,name,email,company"(idis an integer).weights: aString[]where each entry is"field,weight"for a field in {name,email,company}; the weights sum to 1.threshold: a similarity cutoff.targetId: the id of the target record.
The similarity between two records is the weighted sum over the fields of per-field equality (contribute the field's weight when the two records have the same value for that field, otherwise 0). Two records are linked when their similarity is >= threshold.
Return the ids of all records directly linked to the record with targetId (excluding the target itself), as an int[] sorted in ascending order.
Function
findLinkedRecords(rows: String[], weights: String[], threshold: float, targetId: int) → int[]Examples
Example 1
rows = ["1,Alice,alice@gmail.com,Stripe", "2,Alicia,alice@gmail.com,Stripe", "3,Alice,alice@yahoo.com,Google", "4,Bob,bob@gmail.com,Stripe"]weights = ["name,0.2", "email,0.5", "company,0.3"]threshold = 0.5targetId = 1return = [2]Compare each record to record 1 (Alice, alice@gmail.com, Stripe). Record 2: name differs (0), email same (+0.5), company same (+0.3) = 0.8 >= 0.5 -> linked. Record 3: name same (+0.2), email differs, company differs = 0.2 < 0.5 -> not linked. Record 4: name differs, email differs, company same (+0.3) = 0.3 < 0.5 -> not linked. Only record 2 is directly linked.
Example 2
rows = ["1,Alice,alice@gmail.com,Stripe", "2,Alicia,alice@gmail.com,Stripe", "3,Alice,alice@yahoo.com,Google", "4,Bob,bob@gmail.com,Stripe"]weights = ["name,0.2", "email,0.5", "company,0.3"]threshold = 0.5targetId = 4return = []Record 4 is Bob, bob@gmail.com, Stripe. Against record 1: only company matches (0.3). Against record 2: only company matches (0.3). Against record 3: nothing matches (0). All below the 0.5 threshold, so record 4 has no direct links.
Constraints
- Each row is
"id,name,email,company"with an integer id. - Each weight entry is
"field,weight"over {name, email, company}; weights sum to 1. - Similarity = sum of weights of fields whose values are equal between the two records.
- Two records are linked when similarity
>= threshold. - Return the ascending-sorted
int[]of ids directly linked totargetId, excluding the target.
More Stripe Phone Screen questions
- Merchant Payout Scheduler, Part 2: Per-Merchant SchedulesPHONE SCREEN · Seen Nov 2026
- Financial Account LedgerOA · PHONE SCREEN · Seen Nov 2026
- Business Account KYC Verification — Parts 1–5PHONE SCREEN · Seen Nov 2026
- Render a Task Tree from CSV RowsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Invoice / Payment ReconciliationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Linked Merchants Within Two HopsPHONE SCREEN · Seen Nov 2026
- Portfolio Valuation, Part 1PHONE SCREEN · Seen Nov 2026
- Account Roles With Parent-User InheritancePHONE SCREEN · Seen Nov 2026
- Merchant Payout Scheduler, Part 3: Hold PeriodsPHONE SCREEN · Seen Nov 2026
- Merchant Payout Scheduler, Part 1PHONE SCREEN · Seen Nov 2026
Similar questions at other companies
- Group AnagramsWorkday · PHONE SCREEN
- Apply Operations to Make a String EmptyFlexport · PHONE SCREENFlexport interview questions
- Word BreakAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Group AnagramsEPAM · PHONE SCREENEPAM interview questions
- Underline Shortest Unique SubstringsMoveworks · PHONE SCREENMoveworks interview questions
- Find Duplicate File GroupsAnthropic · PHONE SCREENAnthropic interview questions
- Invalid TransactionsBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
- Underline Shortest Unique SubstringsAtlassian · PHONE SCREENAtlassian interview questions
- Insert an Employee into an Organization HierarchyWaymo · PHONE SCREENWaymo interview questions