Amazon interview question

binary tree preorder traversal coding