Skip to main content
mediumGrind 75

Accounts Merge

Given accounts where accounts[i] = [name, email1, email2, ...] Merge accounts belonging to same person (same email) Return merged accounts: [name, sorted_emails...] Order of accounts doesn't matter

Accounts Merge is a traversal problem: the hard part is modeling the state you visit. Interviewers love it because it reveals your traversal modeling and your edge-case discipline. The trap is revisiting states or missing a base case; your visited/queue logic needs to be tight.

Arrays & HashingStringGraphsBFS / DFS

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.

1Merge Accounts Using Union-Findmedium
Based onLeetCode