Amazon interview question

Tree Based Question and One basic Math's.