Update 0226.翻转二叉树.md

This commit is contained in:
QuinnDK
2021-05-12 21:01:01 +08:00
committed by GitHub
parent fbe43be1f4
commit 8fbfc3af8c

View File

@ -208,8 +208,21 @@ Java
Python
Go
```Go
func invertTree(root *TreeNode) *TreeNode {
if root ==nil{
return nil
}
temp:=root.Left
root.Left=root.Right
root.Right=temp
invertTree(root.Left)
invertTree(root.Right)
return root
}
```