题解 | #33.二叉树的镜像#
二叉树的镜像
http://www.nowcoder.com/practice/a9d0ecbacef9410ca97463e4a5c83be7
递归
function Mirror( pRoot ) {
if(pRoot == null)
return;
let tmp = pRoot.left;
pRoot.left = pRoot.right;
pRoot.right = tmp;
Mirror(pRoot.left);
Mirror(pRoot.right);
return pRoot;
}
module.exports = {
Mirror : Mirror
};