剑指 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 };
标签:27,TreeNode,Offer,right,二叉树,mirrorTree,root,left 来源: https://www.cnblogs.com/fresh-coder/p/14283258.html