Qualtrics Interview Question

Tree question using depth-first search