美文网首页
【二叉树】二叉树的镜像

【二叉树】二叉树的镜像

作者: 一个想当大佬的菜鸡 | 来源:发表于2019-08-14 13:31 被阅读0次
    class Solution:
        # 返回镜像树的根节点
        def Mirror(self, root):
            # write code here
            if root == None:
                return root
            temp = self.Mirror(root.right)
            root.right = self.Mirror(root.left)
            root.left = temp
            return root
    

    相关文章

      网友评论

          本文标题:【二叉树】二叉树的镜像

          本文链接:https://www.haomeiwen.com/subject/vrjgjctx.html