← ALL NOTES
Depth-First Search

261. Graph Valid Tree

Given n vertices and a list of undirected edges, decide whether they form a tree — connected and acyclic. The neat shortcut is that you almost never have to look for cycles. A tree on n vertices has…

Loading…