剑指 Offer 27. 二叉树的镜像
同LeetCode226翻转二叉树
1 class Solution { 2 public: 3 TreeNode* mirrorTree(TreeNode* root) { 4 if(root == NULL) return NULL; 5 TreeNode* node = root->left; 6 root->left = root->right; root->right = node; 7 mirrorTree(root->left); 8 mirrorTree(root->right); 9 return root; 10 } 11 };