Approach Summary
Union emails that belong to the same account. Map each email to an owner. Group merged emails by root.
How to Recognize This Pattern
- Merge groups by shared element (email)
Complexity Analysis
Time Complexity
O(n × m × α(n))
Space Complexity
O(n × m)
Tags
Graph Union Find DFS Hash Map