mirror of
https://github.com/TheAlgorithms/C
synced 2025-04-23 05:52:21 +03: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;
|
|
}
|