code: def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
      self.output = []
  
      def preorder(root):
          if not root:
              return self.output
  
          self.output.append(root.val)
          preorder(root.left)
          preorder(root.right)
  
      preorder(root)
      return self.output
  
label_desc: Use image node_id 1 for calling the Solution obj's underlying member method code with example usage: obj.preorderTraversal(root) and returns: self, self