Skip to content

Commit b41c9cf

Browse files
python: add problem 144 and unittest
1 parent 7e828cf commit b41c9cf

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
from typing import List
3+
from common_utils import *
4+
5+
6+
class Solution_141_150(object):
7+
def preorderTraversal(self, root: TreeNode) -> List[int]:
8+
"""
9+
144
10+
:param root:
11+
:return:
12+
"""
13+
results = []
14+
15+
def traversal(node):
16+
if not node:
17+
return
18+
results.append(node.val)
19+
traversal(node.left)
20+
traversal(node.right)
21+
22+
traversal(root)
23+
return results

0 commit comments

Comments
 (0)