Problem · Hash Table
Record Linkage Part 1 - Directly Linked Records
Learn this problemProblem 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 problems
- Group Linked Merchant RecordsPHONE SCREEN · Seen Jul 2026
- Invoice / Payment ReconciliationPHONE SCREEN · Seen Jul 2026
- Incident MonitorOA · Seen Jul 2026
- Merchant Fraud Risk ScoringOA · Seen Jul 2026
- WebSocket Load Balancer — Basic Load Balancing (Part 1)OA · Seen Jul 2026
- Rule-Driven Transaction Fraud DetectionOA · PHONE SCREEN · Seen Jul 2026
- Deployment Window SchedulerOA · Seen Jul 2026
- Directly Linked UsersOA · Seen Jun 2026