mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
Merge pull request #1345 from molonlu/patch-1
Update 0226.翻转二叉树.md -- 与该文其他go示例代码风格相一致
This commit is contained in:
@ -368,9 +368,7 @@ func invertTree(root *TreeNode) *TreeNode {
|
|||||||
if root ==nil{
|
if root ==nil{
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
temp:=root.Left
|
root.Left,root.Right=root.Right,root.Left//交换
|
||||||
root.Left=root.Right
|
|
||||||
root.Right=temp
|
|
||||||
|
|
||||||
invertTree(root.Left)
|
invertTree(root.Left)
|
||||||
invertTree(root.Right)
|
invertTree(root.Right)
|
||||||
|
Reference in New Issue
Block a user