Posts with tag 'union find'

String Equivalence Relations

1 minute read

You are given three lowercase alphabet strings a, b and target. Strings a and b have the same length and are defined to be equivalent: a[i] = b[i]. For examp...

Connect Cartesian Coordinates

1 minute read

You are given a two-dimensional list of integers points where each element contains [x, y] representing a cartesian coordinate. We can make an undirected edg...

Friend Groups

less than 1 minute read

You are given an undirected graph friends as an adjacency list, where friends[i] is a list of people i is friends with. Friendships are two-way. Two people a...

Back to top ↑