Update 0226.翻转二叉树.md

通过tmp显示交换的方式改为golang风格的交换
This commit is contained in:
molonlu
2022-05-18 11:49:55 +08:00
committed by GitHub
parent 047c4db195
commit 552e24b171

View File

@ -368,9 +368,7 @@ func invertTree(root *TreeNode) *TreeNode {
if root ==nil{
return nil
}
temp:=root.Left
root.Left=root.Right
root.Right=temp
root.Left,root.Right=root.Right,root.Left//交换
invertTree(root.Left)
invertTree(root.Right)