Accounts Merge
Medium
Disjoint Set (Union-Find)
Each account lists a name and emails. Two accounts belong to the same person if they share an email. Merge such accounts and print each merged account as: name followed by its sorted unique emails. Accounts are printed in order of their smallest email.
Constraints
1 <= n <= 1000 1 <= k <= 10
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.