Agoda interview question

Tree traversal