validTree = function(n, edges, root = 0) {
    const isEqual = edges.length === (n - 1)
    if (!isEqual) return false;

    const { graph, visited } = buildGraph(n, edges)

    dfs(root, graph, visited);

    return visited.size === n;
}
https://leetcode.com/problems/graph-valid-tree/
Time O(E * a(N)) | Space O(V)
@param {number} n
@param {number[][]} edges
@return {boolean}