Komprise interview question

Question related to binary tree in coding round.