Traveloka interview question

Tree, Simple string detection logic