using root in preorder as indicator of the left sub-tree in inorder
sol of q105