Google interview question

BFS, DFS, and interval trees