class Solution:
    def findTarget(self, root, k):
        """
        :type root: TreeNode
        :type k: int
        :rtype: bool
        """
        if not root:
            return False
        def helper(root):
            if root.left:
                helper(root.left)
            self.ans.append(root.val)
            if root.right:
                helper(root.right)
            return
        self.ans=[]
        helper(root)
        for i in range(len(self.ans)):
            if k-self.ans[i] in self.ans[i+1:]:
                return True
        return False