二叉树的镜像
![](https://img2022.cnblogs.com/blog/1468919/202206/1468919-20220630210028817-3400113.png)
https://leetcode.cn/problems/er-cha-shu-de-jing-xiang-lcof/
/** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ func mirrorTree(root *TreeNode) *TreeNode { ans:=root doTask(root) return ans } func doTask(root *TreeNode) { if root==nil{ return } tmp:=root.Left root.Left=root.Right root.Right=tmp doTask(root.Left) doTask(root.Right) }
等风起的那一天,我已准备好一切