public TreeNode mirrorTree(TreeNode root) {
if (root == null) return null;
if (root.left == null && root.right == null) return root;
TreeNode node = root.left;
root.left = root.right;
root.right = node;
mirrorTree(root.left);
mirrorTree(root.right);
return root;
}
07-20
07-20
07-20
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交