Leetcode 721 Accounts Merge

Problem Statement Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of the account. Now, we would like to merge these accounts. Two accounts definitely belong to the same person if there is some common email to both accounts. Note that even if two accounts have the same name, they may belong to different people as people could have the same name....

December 7, 2022 · 3 min · 559 words · Me

Union Find

Introduction The Union Find data structure stores a collections of disjoint (non-overlapping) sets and can be used to model connected components in undirected graphs. This data structure can be used to: determine if two vetices belong to the same component detect cycles in a graph find the minimum spanning tree of a graph Union Find Implementation Optimized Union Find (Disjoint Set) python implementation with path compression and union by rank....

December 7, 2022 · 2 min · 232 words · Me