题目链接:https://www.nowcoder.com/practice/a9d0ecbacef9410ca97463e4a5c83be7?tpId=196&tqId=37103&rp=1&ru=/exam/oj&qru=/exam/oj&sourceUrl=%2Fexam%2Foj%3Fpage%3D2%26tab%3D%25E7%25AE%2597%25E6%25B3%2595%25E7%25AF%2587%26topicId%3D196&difficulty=undefined&judgeStatus=undefined&tags=&title=
题目如下:
class Solution {
public:
TreeNode* Mirror(TreeNode* pRoot) {
if(pRoot==nullptr) return pRoot;
//根左右,前序遍历
//if(pRoot->left&&pRoot->right){//交换当前节点的左右子树
//注:上一条语句哪怕不是完全二叉树,也可以镜像!!!
auto temp=pRoot->left;
pRoot->left=pRoot->right;
pRoot->right=temp;
//}
Mirror(pRoot->left);
Mirror(pRoot->right);
return pRoot;
}
};



