Merge Rider Accounts That Share a Phone Number or Card
Last updated: November 29, 2026
Quick Overview
Each rider account lists identifiers such as phone numbers and payment card fingerprints; two accounts belong to the same person if they share any identifier, directly or through a chain. Return groups of account ids that should be merged.
Uber
November 29, 20260
0
0 solved
Each rider account lists identifiers such as phone numbers and payment card fingerprints; two accounts belong to the same person if they share any identifier, directly or through a chain. Return groups of account ids that should be merged.
Uber's risk and identity teams link accounts to catch promo abuse and banned riders returning under new emails. The onsite checks whether you model this as connected components and use union find keyed by identifier, rather than comparing every pair of accounts.
What the Interviewer Expects
- Model accounts as nodes connected through shared identifiers
- Map each identifier to the first account that used it
- Use union find with path compression and union by size
- Group accounts by root and return deterministic output
- Discuss false merges from shared family cards
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 avoid merging accounts linked only by a shared corporate card used by thousands?
- How would you run this incrementally as new accounts sign up?
- How would you scale this to billions of identifiers in a batch job?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input:
accounts, list whereaccounts[i]is a list of identifier strings. - Output: list of groups of account indices, each sorted, groups sorted by first element.
- Transitive: A shares with B, ...
High-Level Design
Pairwise comparison is O(n^2 x L). Instead, walk every identifier and keep owner[id], the first account seen with it. When an identifier is seen again, union the current account with its owner. Afte...