Given an array of integers that represent values of nodes in a Binary Search Tree. For example, If the given array is

{9, 4, 17, 6, 5, 3, 7, 22, 20}

Then BST created from above array will be as below

Two numbers are given (along with the array), find largest number in the path between these two numbers in the BST.

For example, if above array is given and the two numbers are 4 and 20, the max number in the path from 4 to 20 is 22. Continue reading »