The Account Links That Stopped One Hop Too Soon
### P2 · One account appears in two groups A synthetic alias report sees A—B and B—C, then emits [A,B] and [B,C]. It counts B twice. Isolated D must remain visible.
Your task: Fix only group_accounts() in components.py. Compute undirected transitive connected components, preserve singleton accounts, and return deterministic sorted groups. Keep the supplied complete-input validation. Use union-find or an equally scalable iterative traversal.
Investigate: Run python monitor.py, then python -m pytest -v. The starter returns 3 groups / 5 memberships; the required result is 2 groups / 4 memberships. Cover cycles, bridge edges, duplicate/reversed/self links, permutations and long chains. Open a PR against main with your reasoning.
This authored exercise groups synthetic IDs under already-approved links. It does not authorize or execute real account merges, establish identity, or test a production identity service.
Skills you'll prove
Interview Tip
I distinguished direct adjacency from transitive connectivity. I used a scalable iterative algorithm, canonicalized the output and tested that every known account appears exactly once. Cycles, duplicate edges and isolated nodes do not change the partition. Approved links are input assumptions, not proof of real identity.