On Sun, Nov 12, 2017 at 02:37:06AM -0800, anish singh wrote:
> Can someone explain me this code to create a trie
> from words?
Not really. What makes this a trie? Where did you get this code from?
> import collections
> words = ["bad", "sad", "abyss"]
>
> Trie = lambda: collections.defaultdict(
anish singh wrote:
> Can someone explain me this code to create a trie
> from words?
>
> import collections
> words = ["bad", "sad", "abyss"]
>
> Trie = lambda: collections.defaultdict(Trie)
> trie = Trie()
> END = True
>
> for i, word in enumerate(words):
> reduce(dict.__getitem__, word, t