Implement an extensible prefix tree | Anthropic Interview Question