# 翻转二叉树 (Invert Binary Tree) ## 题目描述 给你一棵二叉树的根节点 root,翻转这棵二叉树,并返回其根节点。 ## 解题思路 ### 递归 / 迭代 ## Go 代码(递归) ```go func invertTree(root *TreeNode) *TreeNode { if root == nil { return nil } root.Left, root.Right = invertTree(root.Right), invertTree(root.Left) return root } ``` **复杂度:** O(n) 时间,O(h) 空间