Your question is Trie for Financial Term Search. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Implement a trie (prefix tree) from scratch that supports efficient insertion, search, and prefix matching for a large dictionary of financial terms.
Implement def financial_trie(operations):, where each operation is ['insert', term], ['search', term], or ['startsWith', prefix]. Return a list of booleans for search and prefix operations in their original order. Terms and prefixes contain lowercase English letters.
An inserted term must be distinguished from a prefix that is not itself a complete term.
def financial_trie(operations):