Mirror a binary tree
Write mirror(root): turn the binary tree into its mirror image, so that at every node the left and right children trade places, all the way down, and return the root of the result. You may change the tree in place or build a new one; an empty tree stays empty. Each TreeNode has val, left and right.
The tests call the provided run_mirror(values), where values lists the tree level by level with null for a missing child: [1, null, 2, 3] is a root 1 with only a right child 2, whose left child is 3. Your result comes back in the same format.
Examples
run_mirror([4,2,7,1,3,6,9])→[4,7,2,9,6,3,1]run_mirror([1,2])→[1,null,2]run_mirror([])→[]