标签:div root nbsp sel rsa pen end res 题目
给定一个二叉树,返回它的中序 遍历。
# def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: result = [] def inorder(tree, result): if tree != None: if tree.left != None: inorder(tree.left, result) result.append(tree.val) if tree.right != None: inorder(tree.right, result) inorder(root, result) return result
标签:div root nbsp sel rsa pen end res 题目
原文地址:https://www.cnblogs.com/mgdzy/p/13500726.html