12
let idx = this.getIdx(w[0]);13
let node = this.nodes[idx] || new Node(w[0]);14
this.nodes[idx] = node;15
for (let i = 1; i < w.length; ++i) {16
node.children = node.children || Array(26);17
idx = this.getIdx(w[i]);18
let childNode = node.children[idx] || new Node(w[i]);19
node.children[idx] = childNode;26
getExistingWords(w, start) {28
let node = { children: this.nodes };29
for (let i = start; i < w.length; ++i) {30
node = (node.children || [])[this.getIdx(w[i])];36
rslt.push(i - start + 1);44
return ch.charCodeAt(0) - "a".charCodeAt(0);48
var findAllConcatenatedWordsInADict = function (words) {50
words = words.sort((a, b) => a.length - b.length);52
if (words[0].length === 0) {55
const tr = new Trie();56
for (let i = start; i < words.length; ++i) {57
if (check(words[i], 0, tr, Array(words[i].length))) {66
function check(word, i, trie, dp) {67
if (i > word.length || dp[i] === false) {70
if (i === word.length || dp[i] === true) {73
const lens = trie.getExistingWords(word, i);81
if (check(word, i + l, trie, dp)) {