Group Linked Accounts by Shared Attributes

Given a list of records, each consisting of an account and an attribute, two accounts are linked if they share at least one attribute. Linking is transitive (if A and B share attribute x, and B ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: