Google interview question

basic tree implementation, and a weirder medium difficulty one afterwards