Question: Given the root of a binary tree, invert the tree, and return its root.
class Solution {
public TreeNode invertTree(TreeNode root) {
if(root == null)
return null;
TreeNode ans = new TreeNode(root.val);
ans.right = invertTree(root.left);
ans.left = invertTree(root.right);
return ans;
}
}