Ezvor

1804. Implement Trie II (Prefix Tree)

MediumHash Table Preparing judge… LeetCode
Hash TableStringDesignTrie

Hints

Hint 1
Try to solve the first version first and reuse your code.
Hint 2
To implement the delete function, you should delete the trie nodes of the word if they are not shared with other words.
Hint 3
You should keep for each trie node a counter of how many words share this node.