Update trie_preorder.py

This commit is contained in:
bt3gl 2023-08-08 17:02:11 -07:00 committed by GitHub
parent 728b441734
commit 4e895726bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,7 @@ def preorder(root: 'Node'):
stack, result = [root, ], []
while stack:
node = stack.pop()
result.append(node.val)
stack.extend(node.children[::-1])