mirror of
https://github.com/TheAlgorithms/C.git
synced 2026-09-26 17:02:01 +00:00
13 lines
272 B
C
13 lines
272 B
C
struct TreeNode* invertTree(struct TreeNode* root){
|
|
struct TreeNode *tmp;
|
|
if(root == NULL)
|
|
return NULL;
|
|
tmp = root->left;
|
|
root->left = root->right;
|
|
root->right = tmp;
|
|
|
|
invertTree(root->left);
|
|
invertTree(root->right);
|
|
return root;
|
|
}
|