Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.
Example
No.1
Input:
1 | 5 |
Target = 9
Output: True
No.2
Input:
1 | 5 |
Target = 28
Output: False
Code
1 | public class TreeNode { |
1 | public boolean findTarget(TreeNode root, int k) { |