Merge pull request #1 from QuinnDK/添加0226.翻转二叉树Go版本

Update 0226.翻转二叉树.md
This commit is contained in:
QuinnDK 2021-05-13 09:20:44 +08:00 committed by GitHub
commit ccfaa20e7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

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
}
```