diff --git a/coding_test/leetcode/binary_tree_paths/test.py b/coding_test/leetcode/binary_tree_paths/test.py index cbf08fb..889e660 100644 --- a/coding_test/leetcode/binary_tree_paths/test.py +++ b/coding_test/leetcode/binary_tree_paths/test.py @@ -28,7 +28,8 @@ def backtrack(node: TreeNode): backtrack(node.right) stack.pop() - backtrack(root) + if root is not None: + backtrack(root) return result