Learn
Practice
Newsletter
Resources
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Longest Word in Dictionary
Bookmark
Input
Example 1
Example 2
Example 3
Custom
words
=
[w, wo, wor, worl, world]
Phase
Initialization
Current Word
—
Result (Longest Word)
""
Default
Active
Visited
New / Skipped
End of Word
*
algo
master
.
io
Step:
Start: Build a Trie from words, then DFS to find the longest word where every prefix is also a word
0 / 63
Input
Example 1
Example 2
Example 3
Custom
words
=
[w, wo, wor, worl, world]
0 / 63
Phase
Initialization
Current Word
—
Result (Longest Word)
""
Default
Active
Visited
New / Skipped
End of Word
*
algo
master
.
io
Step:
Start: Build a Trie from words, then DFS to find the longest word where every prefix is also a word