Definition for a binary tree node.
class TreeNode(object):
def init(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def mirror(self, root):
“”“
:type root: TreeNode
:rtype: void
“”“
if root == None:return []
root.left,root.right = root.right,root.left
if root.left:
self.mirror(root.left)
if root.right:
self.mirror(root.right)
return root