Back to problems

2D Points Connected Components by Radius

Algorithm · Google · Medium

Requirements Input: a list of 2D points and a radius r. Treat a pair of points as adjacent whenever the Euclidean distance between them is at most r. Cluster membership propagates through chains: when A is linked to B and B is linked to C, each of the three is in one cluster. Return the number of final clusters. Notes Preparation

Checking your access…