Implement a Trie with insert, search, and startsWith methods.
Input: insert("apple"), search("apple") -> true, search("app") -> false, startsWith("app") -> true
Output: true
Topics: trie
Asked by: Google, Amazon
Time complexity: O(L). Space complexity: O(N * L).