| 1 | // Time O (ws + nm*8^s) | Space O(nm + ws) |
| 2 | class Trie { |
| 3 | constructor() { |
| 4 | this.root = {}; |
| 5 | this.endSymbol = "*"; |
| 6 | } |
| 7 | add(string) { |
| 8 | let currentNode = this.root; |
| 9 | for (const char of string) { |
| 10 | if (!currentNode.hasOwnProperty(char)) currentNode[char] = {}; |
| 11 | currentNode = currentNode[char]; |
| 12 | } |
| 13 | currentNode[this.endSymbol] = string; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | function boggleBoard(board, words) { |
| 18 | const finalWords = {}; |
nothing calls this directly
no outgoing calls
no test coverage detected