标签:二叉树 nod loading || int http efi turn 镜像
/**
* 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 null;
if(root.left!=null||root.right!=null){
TreeNode tmp = root.left;
root.left = root.right;
root.right = tmp;
mirrorTree(root.left);
mirrorTree(root.right);
}
return root;
}
}
标签:二叉树 nod loading || int http efi turn 镜像
原文地址:https://www.cnblogs.com/cstdio1/p/13335775.html