Google Interview Question

BFS, DFS, and interval trees