Golang solution (0ms)


  • 1
    func invertTree(root *TreeNode) *TreeNode {
        if root == nil { return nil }
        root.Left, root.Right = invertTree(root.Right), invertTree(root.Left)
        return root
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.