Approach hintTry it first, then revealHide
Insert all words into a trie and start a DFS from every cell, advancing the trie node along the path. Clear a word once found and prune empty branches so finished parts of the trie are not explored again.
Insert all words into a trie and start a DFS from every cell, advancing the trie node along the path. Clear a word once found and prune empty branches so finished parts of the trie are not explored again.