solution to buildTree (in-order and post-order)