# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def findTarget(self, root: TreeNode, k: int) -> bool:
if not root:
return False
s = set()
q = [root]
while q:
size = len(q)
for i in range(size):
node = q.pop(0)
if k - node.val in s:
return True
s.add(node.val)
if node.left:
q.append(node.left)
if node.right:
q.append(node.right)
return False