1、前言
题目描述2、思路
3、代码
class Solution {
public TreeNode mirrorTree(TreeNode root) {
if(root == null){
return root;
}
mirrorTree(root.left);
mirrorTree(root.right);
TreeNode temp = root.left;
root.left = root.right;
root.right = temp;
return root;
}
}
网友评论