(row, col, board, visited, trieNode, finalWords)
| 31 | } |
| 32 | |
| 33 | function explore(row, col, board, visited, trieNode, finalWords) { |
| 34 | if (visited[row][col]) return; |
| 35 | const letter = board[row][col]; |
| 36 | if (!trieNode.hasOwnProperty(letter)) return; |
| 37 | visited[row][col] = true; |
| 38 | trieNode = trieNode[letter]; |
| 39 | if ("*" in trieNode) finalWords[trieNode["*"]] = true; |
| 40 | const neighbors = getNeighbors(row, col, board); |
| 41 | |
| 42 | for (const neighbor of neighbors) { |
| 43 | explore(neighbor[0], neighbor[1], board, visited, trieNode, finalWords); |
| 44 | } |
| 45 | visited[row][col] = false; |
| 46 | } |
| 47 | |
| 48 | function getNeighbors(row, col, board) { |
| 49 | const neighbors = []; |
no test coverage detected