Bootstrap

Golang | Leetcode Golang题解之第226题翻转二叉树

题目:

题解:

func invertTree(root *TreeNode) *TreeNode {
    if root == nil {
        return nil
    }
    left := invertTree(root.Left)
    right := invertTree(root.Right)
    root.Left = right
    root.Right = left
    return root
}
;