LeetCode 208 Implement Trie - Problem Statement

The problem

Implement a Trie (prefix tree) with these operations:

Trie(): Initialize the trie.

insert(word): Insert a word into the trie.

search(word): Return true if the exact word is in the trie.

startsWith(prefix): Return true if any word in the trie starts with the given prefix.

With operations: insert("apple"), search("apple") returns true, search("app") returns false, startsWith("app") returns true, insert("app"), search("app") returns true.

Constraints: Words and prefixes contain only lowercase English letters.