Given the root of a binary tree, invert the tree, and return its root.

&nbsp;
Example 1:

Input: root = [4,2,7,1,3,6,9]
Output: [4,7,2,9,6,3,1]


Example 2:

Input: root = [2,1,3]
Output: [2,3,1]


Example 3:

Input: root = []
Output: []


&nbsp;
Constraints:


	The number of nodes in the tree is in the range [0, 100].
	-100 &lt;= Node.val &lt;= 100


class Solution(object):
    def invertTree(self, root):
        # Base case...
        if root == None:
            return root
        # swapping process...
        root.left, root.right = root.right, root.left
        # Call the function recursively for the left subtree...
        self.invertTree(root.left)
        # Call the function recursively for the right subtree...
        self.invertTree(root.right)
        return root     # Return the root...
class Solution {
    public TreeNode invertTree(TreeNode root) {

        swap(root);
        return root;
    }

    private static void swap(TreeNode current) {
        if (current == null) {
            return;
        }

        swap(current.left);
        swap(current.right);

        TreeNode temp = current.left;
        current.left = current.right;
        current.right = temp;
    }
}
class Solution {
public:
    TreeNode* invertTree(TreeNode* root) {
        if(root == NULL) return root;
        TreeNode* temp = root->left;
        root->left = root->right;
        root->right = temp;
        invertTree(root->left);
        invertTree(root->right);
        return root;
    }
};
var invertTree = function(root) {
  if (!root) return root;
    [root.left, root.right] = [root.right, root.left];
    invertTree(root.right)
    invertTree(root.left)
     return root
};
Invert Binary Tree