AlgoMaster Logo

721. Accounts Merge

accounts=[["John","j1@ex.com","j2@ex.com"],["John","j2@ex.com","j3@ex.com"],["Mary","m1@ex.com"]]
0 / 10
Union-Find Structurej1@ex.comrootj2@ex.comrootj3@ex.comrootm1@ex.comrootLegend:DefaultProcessingActiveHighlight
algomaster.io
Step:Given 3 accounts with 4 unique emails. Initialize Union-Find where each email is its own parent.