Given the root of a binary tree, invert the tree (mirror it), and return its root.
Input:
4
/ \
2 7
/ \ / \
1 3 6 9
Output:
4
/ \
7 2
/ \ / \
9 6 3 1
Input: root = [4,2,7,1,3,6,9] Output: [4,7,2,9,6,3,1] Explanation: Every node's left and right children are swapped throughout the entire tree.
Input: root = [2,1,3] Output: [2,3,1] Explanation: The root's two children are swapped.
Input: root = [] Output: [] Explanation: An empty tree inverted is still empty.
root = [4,2,7,1,3,6,9]