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
Build trie over reversed words. Append new letters to stream and scan all suffixes from end against trie in O(maxWordLen) per query.
Any matching word suffix appears as a reversed prefix from the newest stream characters, so checking backwards in reverse-trie detects all endings.
Updated Feb 2026