Digital dictionary

got the feel how to do but not able to implement

also didn’t got reading the editorial

Hello @hg11110000 this is the explanation for it :
Build a trie of all the strings given to you at the starting. Now, for every string that you query, search it in the trie and if it reaches some node of your trie successfully, that means there is at least one word that is present as an answer. Now , start moviing down the trie from that node till you hit a leaf and every time you encounter a end of word, just print the string. The other case, just add the string to your trie.
Here for your reference i am attaching the code:


Happy Learning!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.