题目
链接:https://leetcode-cn.com/problems/invert-binary-tree/
代码
class Solution {
public TreeNode invertTree(TreeNode root) {
if (root == null)
return null;
TreeNode right = invertTree(root.right);
TreeNode left = invertTree(root.left);
root.right = left;
root.left = right;
return root;
}
}
```