problem653

package
v1.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2020 License: MIT Imports: 0 Imported by: 0

README

< Previous                  Next >

653. Two Sum IV - Input is a BST (Easy)

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

 

[Tree]

Similar Questions

  1. Two Sum (Easy)
  2. Two Sum II - Input array is sorted (Easy)
  3. Two Sum III - Data structure design (Easy)
  4. Two Sum BSTs (Medium)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL