Link Rakuten IDs That Share an Email or Phone Number

Last updated: November 29, 2026

Quick Overview

Given accounts as (account_id, list of identifiers such as emails and phone numbers), merge accounts that share any identifier directly or transitively and return the resulting groups of account ids.

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

0

0

0 solved


Given accounts as (account_id, list of identifiers such as emails and phone numbers), merge accounts that share any identifier directly or transitively and return the resulting groups of account ids.

A single Rakuten ID spans Ichiba, Travel, Mobile, Card and more, and fraud and identity teams need to cluster accounts that are really one person or one ring. This screen checks whether you see transitive grouping as union find and implement it with path compression.

What the Interviewer Expects
  • Recognize transitive merging as connected components
  • Implement union find with path compression and union by rank
  • Map each identifier to its first owner
  • Normalize identifiers before matching
  • State near-linear complexity
Key Topics to Cover
union find
connected components
hashing
identity resolution
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
  • Some shared identifiers are noisy, like a store's phone number used by hundreds of customers. How do you stop giant false clusters?
  • Accounts stream in continuously. Can union find support that? What about un-linking?
  • How would you do this as a distributed job over billions of identifiers?
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

Two accounts belong together if they share an identifier, or are connected through a chain of shared identifiers. Identifiers compare case-insensitively after trimming. Output each group sorted, group...

High-Level Design

Treat accounts as nodes. Instead of comparing every pair, keep a map from identifier to the first account index that used it. When a later account uses the same identifier, union the two. That creates...


Submit Your Answer
Markdown supported

Related Questions