标签:val treenode roo tree 翻转 剑指offer mirror off ptr
class Solution {
public:
void Mirror(TreeNode *pRoot) {
if(pRoot == nullptr) return;
cout << pRoot->val << endl;
auto temp = pRoot->left;
pRoot->left = pRoot->right;
pRoot->right = temp;
Mirror(pRoot->left);
Mirror(pRoot->right);
}
};
标签:val treenode roo tree 翻转 剑指offer mirror off ptr
原文地址:https://www.cnblogs.com/theodoric008/p/9535810.html