Question
Given the root of a Binary Search Tree and a target number k, return true if there exist two elements in the BST such that their sum is equal to the given target.
Example 1:

Input: root = [5,3,6,2,4,null,7], k = 9 Output: true
Example 2:

Input: root = [5,3,6,2,4,null,7], k = 28 Output: false
Constraints:
- The number of nodes in the tree is in the range
[1, 104]. -104 <= Node.val <= 104rootis guaranteed to be a valid binary search tree.-105 <= k <= 105
Python Solution
# 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
def inorder(root,l):
if root==None:return
inorder(root.left,l)
l.append(root.val)
inorder(root.right,l)
class Solution:
def findTarget(self, root: TreeNode, k: int) -> bool:
l = []
inorder(root,l)
i=0
j=len(l)-1
while i<j:
if l[i]+l[j]==k:return True
elif l[i]+l[j]<k:i+=1
else:j-=1
return False

![[Solved] You are given an integer n and an integer start. Define an array nums where nums[i] = start + 2 * i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums.](https://machinelearningprojects.net/wp-content/uploads/2022/09/Leetcode-solutions-MLP-Feature-Image-1024x536.webp)