MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / initGraph

Function initGraph

javascript/0261-graph-valid-tree.js:19–22  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

17};
18
19var initGraph = (n) => ({
20 graph: new Array(n).fill().map(() => []),
21 visited: new Set(),
22});
23
24var buildGraph = (n, edges) => {
25 const { graph, visited } = initGraph(n);

Callers 1

buildGraphFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected