标签:tor 二叉树遍历 solution post ret 树遍历 tree traversal size
后序递归:
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def postorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] """ if root == None: return [] return self.postorderTraversal(root.left)+self.postorderTraversal(root.right)+[root.val]
标签:tor 二叉树遍历 solution post ret 树遍历 tree traversal size
原文地址:https://www.cnblogs.com/yejiang/p/10301273.html