A trie (pronounced as "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
insert(word)inserts the stringwordinto the trie.search(word)returnstrueif the stringwordis in the trie (i.e., was inserted before), andfalseotherwise.startsWith(prefix)returnstrueif there is a previously inserted stringwordthat has the prefixprefix, andfalseotherwise.
Note: For this problem, implement operations as a function that takes a list of commands and returns the results. Return null for void operations (insert).