Prefix Tree Operations
Simulate a trie. Each operation is ["insert", word], ["search", word] (is the exact word present?) or ["prefix", text] (does any inserted word start with text?). Return the boolean results of the search and prefix operations, in order.
Examples
A guided view of the published example, not a trace of your code.
[[["insert","apple"],["search","apple"],["search","app"],["prefix","app"],["insert","app"],["search","app"]]][true,false,true,true]Start with the input values shown in this example.
Input: operations = [["insert","apple"],["search","apple"],["search","app"],["prefix","app"],["insert","app"],["search","app"]]
Output: [true,false,true,true]
Explanation: classic
Input: operations = [["prefix","a"]]
Output: [false]
Explanation: empty trie
Input: operations = [["insert",""],["search",""],["prefix",""]]
Output: [true,true]
Explanation: empty word
Hint 1
Each node is a dictionary from character to child, plus an end-of-word flag.