text: class Solution:
      def invertTree(self):
          if root:
              tmp = root.left
              root.left = self.invertTree(root.right)
              root.right = self.invertTree(tmp)
          return root
  