MCPcopy Index your code
hub / github.com/betomoedano/JavaScript-Coding-Interview-Questions / boggleBoard

Function boggleBoard

graphs/boggle-board.js:17–31  ·  view source on GitHub ↗
(board, words)

Source from the content-addressed store, hash-verified

15}
16
17function boggleBoard(board, words) {
18 const finalWords = {};
19 const visited = board.map((row) => row.map((letter) => false));
20 const trie = new Trie();
21 for (const word of words) {
22 trie.add(word);
23 }
24
25 for (let row = 0; row < board.length; row++) {
26 for (let col = 0; col < board[0].length; col++) {
27 explore(row, col, board, visited, trie.root, finalWords);
28 }
29 }
30 return Object.keys(finalWords);
31}
32
33function explore(row, col, board, visited, trieNode, finalWords) {
34 if (visited[row][col]) return;

Callers

nothing calls this directly

Calls 2

addMethod · 0.95
exploreFunction · 0.85

Tested by

no test coverage detected