GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • All topics
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 20 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
Log inStart free
Gamified challengesAccount Merger

Gamified challenge · Union-find

Account Merger

Each sign-up is one string "Name:email1,email2,...". Two sign-ups that share any email belong to the same person, and so does anything linked to them through a chain of shared emails. Different people may have the same name, but never the same email.

Write mergeAccounts(accounts) (Python: merge_accounts) that returns one list per person: the name first, then all of that person's emails without repeats, in sorted order (plain string order). The people may come in any order.

Example: ["Ava:ava@mail.io,ava.k@web.co", "Ben:ben@post.net", "Ava:ava.k@web.co,ak@post.net", "Ava:ava2@mail.io"] → [["Ava", "ak@post.net", "ava.k@web.co", "ava@mail.io"], ["Ava", "ava2@mail.io"], ["Ben", "ben@post.net"]].

Sign in to play Account Merger

This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.

Sign in with Google

or log in with email · create an account