Company: Media_Net__SDE_17nov
Difficulty: medium
Recover Binary Search Tree Problem A binary search tree held n distinct integers. Someone then exchanged the values stored at exactly two of its nodes, which may or may not be adjacent, and the tree stopped being a search tree. Given the damaged tree, find the two values whose exchange puts it right again, and return them in ascending order. Complete the function recoverTree , which receives the root of the tree and returns the two values. Input Format One line holding the tree in level order. The first token is the root. After that, each node taken from the queue consumes two tokens - its left child and then its right child - and the token null stands for a missing child. Trailing null tokens are omitted. For example, 3 1 4 null null 2 describes the tree 3 / \ 1 4 / 2 Output Format Print the two values as [a, b] with a < b , exactly one space after the comma. Constraints 2 <= n <= 8000 -10^9 <= value of a node <= 10^9 All values are distinct. The tree is a valid binary