Build the PrimitiveMedium
Graph Valid Tree
Write `valid_tree(n, edges)` returning `True` when the undirected graph on `n` nodes is a tree: connected and acyclic.
valid_tree(5, [[0,1],[0,2],[0,3],[1,4]]) -> True
Two conditions, and both are needed. Exactly `n - 1` edges rules out cycles *given* connectivity; connectivity rules out a graph that is a cycle plus an isolated node. Check the edge count first, then a single traversal reaching all n nodes.
What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.