Amazon interview question

Binary search tree leetcode medium