3 ms·
Nuts it may be, but rename it trie = defaultdict(lambda: defaultdict(trie)) and you have a 1-line trie data structure, which is super useful.
by joshuamorton 8y ago
Nuts it may be, but rename it
trie = defaultdict(lambda: defaultdict(trie))
and you have a 1-line trie data structure, which is super useful.
- Ultimatt 8y agoNot sure how it's a trie at all. Nothing is imposing prefixes here. But it is a tree sure.