Medium · Graphs · about 20 minutes
Asked at Google, Meta, LinkedIn, Amazon.
Given n nodes labeled 0..n-1 and a list of undirected edges, return true if the edges form a valid tree: connected and without cycles.
n
edges