Python simple solution 97th percentile


  • 0
    S
    def invertTree(self, root):
            if root:
                self.invertTree(root.left)
                self.invertTree(root.right)
                temp = root.left
                root.left = root.right
                root.right = temp
                return root
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.