Given n nodes labeled 0 to n - 1 and a list of undirected edges. Determine whether these edges make up a valid tree.
"A graph is a tree if and only if it is connected and has no cycles. Graph theory proves: for $n$ nodes, having $n-1$ edges and being fully connected automatically implies 0 cycles!"
"If edges.length != n - 1, return false immediately! Fewer edges means disconnected components; more edges means guaranteed cycles."
"Since edges.length == n - 1 is verified, we only need to check if all $n$ nodes belong to 1 connected component. Run BFS/DFS from node 0 and check visitedCount == n."
"Because we gate on $E = n - 1$, BFS visits at most $n$ vertices and $n-1$ edges. Total time is strictly $O(n)$, and auxiliary space is $O(n)$."