leetcode-剑指27-OK
language: C
// 很简单的递归
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* struct TreeNode *left;
* struct TreeNode *right;
* };
*/
struct TreeNode* mirrorTree(struct TreeNode* root){
struct TreeNode* temp;
void inverse(struct TreeNode* one){
if(one==NULL)
return;
temp = one->left;
one->left = one->right;
one->right = temp;
inverse(one->left);
inverse(one->right);
}
inverse(root);
return root;
}