Qualtrics interview question

Tree question using depth-first search