Word Search II
hardFind all words in a board using trie-guided DFS
Word Search II
Key Insight
Prune DFS on board cells by checking whether the current path exists as trie prefix.
Step 1Build Word Trie
Array
oath
0pea
1eat
2rain
3HashMap
o:1
p:1
e:1
r:1
Insert oath, pea, eat, and rain before DFS.
1 / 3