It's actually quite a simple question

```
class Solution {
public:
TreeNode* invertTree(TreeNode* root) {
swapChild(root);
return root;
}
void swapChild(TreeNode* root){
if ( root == NULL)
return;
if(root->left != NULL)
swapChild(root->left);
if(root->right != NULL)
swapChild(root->right);
TreeNode* tmp = root->left;
root->left = root->right;
root->right = tmp;
}
};
```