Amazon Interview Question

LC medium was finding the connected components of a graph.