text: from .model import TreeNode
  
  """
  Space   : O(n)
  Time    : O(n)
  """
  
  
  class Solution:
      def searchBST(self, root: TreeNode, val: int) -> TreeNode:
          if not root:
              return None
  
          stack = [root]
          while stack:
              node = stack.pop()
              if node.val == val:
                  return node
              if node.left:
                  stack.append(node.left)
              if node.right:
                  stack.append(node.right)
  
          return None
  