Zillow interview question

Tree manipulation problem