思路:将每一级的左右子树看成新的树,先递归完左子树,再递归右子树,返回反转后的子树的根。

# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

#
# 
# @param pRoot TreeNode类 
# @return void
#
class Solution:
    def Mirror(self , pRoot ):
        if not pRoot:
            return pRoot
        new_right=self.Mirror(pRoot.left)
        new_left=self.Mirror(pRoot.right)

        pRoot.left=new_left
        pRoot.right=new_right

        return pRoot