Amazon interview question

Reconstruct a BST from preorder traversal