The number of nodes in the tree is in the range [0, 100].
-100 <= Node.val <= 100
解題
/** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */funcinvertTree(root *TreeNode) *TreeNode {invert(root)return root}funcinvert(root *TreeNode) {if root !=nil {invert(root.Left)invert(root.Right) root.Left, root.Right = root.Right, root.Left }}