From c73d9cd8832aaf16a767dfec5c5199e4a38a4f91 Mon Sep 17 00:00:00 2001 From: KDH Date: Tue, 5 Nov 2024 14:14:34 +0900 Subject: [PATCH] handle none case --- coding_test/leetcode/binary_tree_paths/test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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