MCPcopy Index your code
hub / github.com/neetcode-gh/leetcode / buildGraph

Function buildGraph

javascript/0269-alien-dictionary.js:25–36  ·  view source on GitHub ↗
(words)

Source from the content-addressed store, hash-verified

23});
24
25var buildGraph = (words) => {
26 const { graph, frequencyMap, queue, buffer } = initGraph();
27
28 for (const word of words) {
29 for (const char of word) {
30 frequencyMap.set(char, 0);
31 graph.set(char, []);
32 }
33 }
34
35 return { graph, frequencyMap, queue, buffer };
36};
37
38var canBuildGraph = (words, graph, frequencyMap) => {
39 for (let index = 0; index < words.length - 1; index++) {

Callers 1

alienOrderFunction · 0.70

Calls 2

initGraphFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected