func inorderTraversal(root *TreeNode) []int {
if root == nil {
return nil
}
r1 := inorderTraversal(root.Left)
r2 := inorderTraversal(root.Right)
return append(append(r1, root.Val), r2...)
}
22力扣算法-二叉树的中序遍历
最新推荐文章于 2024-02-19 14:28:45 发布