Link Yahoo Accounts That Share Recovery Emails or Phone Numbers

Last updated: November 29, 2026

Quick Overview

Each Yahoo account lists recovery identifiers such as alternate emails and phone numbers. Group accounts that are connected directly or transitively through any shared identifier, treating identifiers case-insensitively, and return the groups.

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

0

0

0 solved


Each Yahoo account lists recovery identifiers such as alternate emails and phone numbers. Group accounts that are connected directly or transitively through any shared identifier, treating identifiers case-insensitively, and return the groups.

Account security and abuse teams at Yahoo need to find clusters of linked accounts for recovery flows and fraud review. The interviewer is checking whether you recognize connected components and implement union-find with path compression and union by size.

What the Interviewer Expects
  • Recognize transitive linking as connected components
  • Map each normalized identifier to the first account that used it
  • Union accounts through shared identifiers
  • Implement path compression and union by size
  • Return deterministic sorted groups
Key Topics to Cover
union find
connected components
hashing
normalization
graph modeling
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
  • How would you scale this to a billion accounts on a cluster?
  • Some shared identifiers, like a corporate helpdesk phone, are too common. How would you avoid giant false clusters?
  • How would you support un-linking when a user removes a phone number?
  • How would you compare union-find with BFS over a bipartite graph here?
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

Input: dict account_id -> list[identifier]. Two accounts are linked if they share an identifier after trimming and lowercasing; linking is transitive. Output: sorted list of sorted groups, including...

High-Level Design

Model accounts as nodes. Instead of building all pairwise edges (quadratic for popular identifiers), keep owner[identifier] = first account seen. When a later account has the same identifier, union ...


Submit Your Answer
Markdown supported