$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · easy · #319

What goes in the blank?

# trie as nested dicts: insert one word
node = root
for ch in word:
    node = node.setdefault(ch, ____)
node['$'] = True

Answer: {} (also accepted: {}, dict())

setdefault returns the existing child or creates an empty dict for it, so the walk continues one level deeper per character.
Play Problem Solving ▸