Amazon interview question

tree serialize and deserialize