Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
364 B
2
Indexable
Never
class Solution(object):
    def invertTree(self, root):
        """
        :type root: TreeNode
        :rtype: TreeNode
        """
        if root:
            self.invertTree(root.left)
            self.invertTree(root.right)
            
            temp = root.left
            root.left = root.right
            root.right = temp
        return root        
Leave a Comment