/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public TreeNode mirrorTree(TreeNode root) {
if(root==null){
return root;
}
TreeNode temp=root.left;
root.left=root.right;
root.right=temp;
mirrorTree(root.left);
mirrorTree(root.right);
return root;
}
}
怀念这种难度的代码,但这是畏难心理。要不得