Merge pull request #1345 from molonlu/patch-1

Update 0226.翻转二叉树.md -- 与该文其他go示例代码风格相一致
This commit is contained in:
程序员Carl
2022-06-10 09:35:03 +08:00
committed by GitHub

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)