/* function TreeNode(x) {
this.val = x;
this.left = null;
this.right = null;
} */
function Mirror(root)
{
// write code here
if(!root) return null
function buildImage(root){
if(!root.left && !root.right) return
var temp = root.left
root.left = root.right
root.right = temp
if(root.left) buildImage(root.left)
if(root.right) buildImage(root.right)
}
buildImage(root)
return root
}
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交