# Graph Valid Tree N-1 Edges
**Idea.** Union-Find with exactly n-1 edges and no cycle, or DFS connectivity.
**Interview tip.** Restate constraints, give brute force first, then optimize. Trace one example out loud before coding.
*Disclosure: practice note shared by the Linkjob AI team.* For live mock-interview practice see [undetectable AI interview copilot](https://www.linkjob.ai/).
Read 3 times, last 24 hours ago