leetle

Daily challenge for 2025-11-10

314. Implement Trie (Prefix Tree)

A trie (prefix tree) is a tree data structure used to efficiently store and retrieve keys in a dataset of strings.

Implement a function solve(operations, values) that performs a series of operations on a Trie and returns the results.

Operations:
- "insert": Insert a word into the trie
- "search": Return True if the word is in the trie
- "startsWith": Return True if there's any word with the given prefix

Example:
Input: operations = ["insert","search","search","startsWith"], values = ["apple","apple","app","app"]
Output: [null,true,false,true]

Run this challenge interactively in Python or JavaScript when the app loads.