二叉树的镜像

2019-12-27  本文已影响0人  而立之年的技术控
微信图片_20191227153825.jpg
class Solution:
    # 返回镜像树的根节点
    def Mirror(self, root):
        # write code here
        if not root:
            return None
        root.left, root.right = root.right, root.left
        self.Mirror(root.left)
        self.Mirror(root.right)
        return root
上一篇 下一篇

猜你喜欢

热点阅读