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

Function alienOrder

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

Source from the content-addressed store, hash-verified

5 * @return {string}
6 */
7var alienOrder = function (words) {
8 const { graph, frequencyMap, queue, buffer } = buildGraph(words);
9
10 if (!canBuildGraph(words, graph, frequencyMap)) return '';
11
12 queueSources(queue, frequencyMap);
13 bfs(queue, frequencyMap, graph, buffer);
14
15 return frequencyMap.size <= buffer.length ? buffer.join('') : '';
16};
17
18var initGraph = () => ({
19 graph: new Map(),

Callers

nothing calls this directly

Calls 6

canBuildGraphFunction · 0.85
queueSourcesFunction · 0.85
buildGraphFunction · 0.70
bfsFunction · 0.70
dfsFunction · 0.70
reverseMethod · 0.45

Tested by

no test coverage detected