GoLang Solution For LeetCode Problem: Two Sum IV Input is a BST
Solving Two Sum IV Input is a BST in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.
Problem Description
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 1:
Input:
5
/ \
3 6
/ \ \
2 4 7
Target = 9
Output: True
Example 2:
Input:
5
/ \
3 6
/ \ \
2 4 7
Target = 28
Output: False
See the full details of the problem Two Sum IV Input is a BST at LeetCode
Originally posted at: @github.com/halfrost/LeetCode-Go
Comments
Leave a comment
You are not LoggedIn but you can comment as an anonymous user which requires manual approval. For better experience please Login.