题目描述
<?php
/*class TreeNode{
var $val;
var $left = NULL;
var $right = NULL;
function __construct($val){
$this->val = $val;
}
}*/
function Mirror(&$root)
{
// write code here
$tree=new TreeNode(null);
if($root!=null){
$tree=$root->right;
$root->right=$root->left;
$root->left=$tree;
if($root->left!=null){
Mirror($root->left);
}
if($root->right!=null){
Mirror($root->right);
}
}
return $root;
}
1万+



被折叠的 条评论
为什么被折叠?



