Consolidate Duplicate Business Partners Sharing Tax ID, Email, or IBAN
Last updated: November 29, 2026
Quick Overview
Business partner records each carry an optional tax ID, email, and IBAN. Two records belong to the same real-world partner if they share any normalized identifier, directly or through a chain of other records; return the groups of record ids.
SAP
November 29, 20260
0
0 solved
Business partner records each carry an optional tax ID, email, and IBAN. Two records belong to the same real-world partner if they share any normalized identifier, directly or through a chain of other records; return the groups of record ids.
SAP Master Data Governance teams use this problem because duplicate customers and suppliers are a classic data quality issue during S/4HANA migrations. The interviewer checks that you see transitive matching as connected components and that you normalize identifiers before comparing them.
What the Interviewer Expects
- Recognizes transitive matching as a connected-components problem
- Uses union-find with path compression and union by rank
- Indexes each normalized identifier once rather than comparing all pairs
- Normalizes values (case, whitespace, separators) and ignores empty fields
- Keeps identifier types separate so an email never matches an IBAN
- Returns deterministic, sorted output
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
- How would you handle a shared generic email like info@ that wrongly merges unrelated companies?
- How would you run this across 50 million records that do not fit on one machine?
- How would you support incremental updates as new partners are created each day?
- How would you pick the surviving golden record within each group?
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 an id and up to three identifiers. Empty or missing values never link anything. Matching is transitive: if A shares an email with B and B shares an IBAN with C, all three are one group...
High-Level Design
Comparing all pairs is O(n^2). Instead keep a dictionary from (field, normalized_value) to the first record that had it. When a later record has the same key, union the two. Union-find then holds th...