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

Function buildGraph

javascript/0332-reconstruct-itinerary.js:36–45  ·  view source on GitHub ↗
(tickets, graph = new Map())

Source from the content-addressed store, hash-verified

34};
35
36const buildGraph = (tickets, graph = new Map()) => {
37 for (const [src, dst] of tickets) {
38 const edges = graph.get(src) || [];
39
40 edges.push(dst);
41 graph.set(src, edges);
42 }
43
44 return graph;
45};

Callers 1

findItineraryFunction · 0.70

Calls 3

getMethod · 0.45
pushMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected