LeetCode(94)Binary Tree Inorder Traversal

Posted 你瞅啥

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode(94)Binary Tree Inorder Traversal相关的知识,希望对你有一定的参考价值。

题目如下:

Python代码:

    def inorderTraversal(self, root):
        res = []
        self.helper(root, res)
        return res
    
    def helper(self, root, res):
        if root:
            self.helper(root.left, res)
            res.append(root.val)
            self.helper(root.right, res)

 

以上是关于LeetCode(94)Binary Tree Inorder Traversal的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode 94:Binary Tree Inorder Traversal

[leetcode-94-Binary Tree Inorder Traversal]

[LeetCode]94.Binary Tree Inorder Traversal

leetcode 94. Binary Tree Inorder Traversal

LeetCode94 Binary Tree Inorder Traversal

LeetCode 94: Binary Tree Inorder Traversal