LC: 1214. Two Sum BSTs - spiralgo/algorithms GitHub Wiki
The Essence:
Searching for a sum of two values in two trees is equivalent to searching the difference of the total sum and some value of the first tree within the second tree. Since the second tree is a binary tree, this search can be done by choosing the right smaller/larger value of tree.
Details:
The two sum is present if, the difference of the total and root node is present in the second tree. Otherwise, this must be checked for the left and the right nodes. The search in the 2. tree can be done using preorder traversal.