Amazon interview question

Tree question was asked actually