递归,先交换左右子树,然后对左右子树递归求解。

Morris遍历算法太复杂了,就不强求常数空间复杂度了。。。

class Solution {
public:
    TreeNode* Mirror(TreeNode* pRoot) {
        if (!pRoot) return nullptr;
        swap(pRoot->left, pRoot->right);
        Mirror(pRoot->left);
        Mirror(pRoot->right);
        return pRoot;
    }
};