Stream of Characters — Reverse Suffix Trie
Query if any word ends at the current stream position. Insert reversed words into trie; maintain suffix deque to match from current position backwards.
webcoderspeed.com
1276 articles
Query if any word ends at the current stream position. Insert reversed words into trie; maintain suffix deque to match from current position backwards.
Find word with given prefix AND suffix. Insert 'suffix#word' for each suffix of each word into trie; query combines prefix+suffix search.
For each word, sum up how many other words share each of its prefixes. Trie with prefix count at each node; query each word's prefix sum.
Find all words that can be formed by concatenating two or more words from the same list. Build trie, then run word break DP on each word.
Encode word list as shortest string where each word is a suffix. Words that are suffixes of others need not be separately encoded. Use trie of reversed words.