Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Insert all words, then DFS only through nodes that are complete words and keep the longest valid chain.
A valid chain requires every prefix to be present; DFS restricted to terminal nodes automatically explores exactly those candidates.
Updated Feb 2026