Amazon interview question

Function to detect if Binary tree is BST.