Given the root of a binary tree, invert the tree, and return its root.
Example 1
Input: root = [4,2,7,1,3,6,9]
Output: [4,7,2,9,6,3,1]
Explanation: Swapping the left and right children of every node mirrors the tree. 2 and 7 trade places under 4, then 1/3 and 6/9 trade places under their parents, giving [4,7,2,9,6,3,1].
Example 2
Input: root = [2,1,3]
Output: [2,3,1]
Explanation: The children 1 and 3 swap sides under the root 2.
Example 3
Input: root = []
Output: []
Explanation: The tree is empty, so there is nothing to invert.
Inverting a tree means mirroring it: swap every node's left and right children. Recurse into both subtrees and swap on the way, and the whole tree flips.
Run checks all cases above. Submit evaluates all test cases.