Serialize and Deserialize Dictionary Trie
Examples
Example 1:
Input: words = ["app","apple","bat"]
Output: ["app","apple","bat"]
Explanation:
Example 2:
Input: words = ["dog","deer","deal"]
Output: ["deal","deer","dog"]
Explanation:
Example 1:
Input: words = ["app","apple","bat"]
Output: ["app","apple","bat"]
Explanation:
Example 2:
Input: words = ["dog","deer","deal"]
Output: ["deal","deer","dog"]
Explanation:
Implement a codec for a dictionary trie.
You are given a list of unique lowercase words. Build a trie from these words and implement:
serialize(words) -> converts the trie into a string.deserialize(data) -> reconstructs the trie from the string and returns all words in the trie in lexicographical order.You may design any valid serialization format, as long as deserialize(serialize(words)) recovers the same dictionary.
Notes:
After serializing and deserializing, the recovered dictionary words in lexicographical order are unchanged.
Output is lexicographically sorted words from the reconstructed trie.
0 <= words.length <= 10^41 <= words[i].length <= 50words[i] contains only lowercase English letters.words contains unique strings.2 * 10^5.