翻转二叉树
作者:互联网
题目
链接: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;
}
}
```
标签:right,TreeNode,invertTree,null,二叉树,翻转,root,left 来源: https://blog.csdn.net/qq_29494693/article/details/116432511