三亩地 三亩地SAN MU DI · CODE DIARY
ARTICLE DETAIL

日记详情

真实记录编程学习的某一天,欢迎挑你感兴趣的翻一翻。

Leetcode 94. 二叉树的中序遍历

Leetcode 94. 二叉树的中序遍历

classSolution:definorderTraversal(self,root:Optional[TreeNode])->List[int]:self.res=[]defintree(node):ifnotnode:returnNoneintree(node.left)self.res.append(node.val)intree(node.right)intree(root)returnself.res
← 返回列表