IXL Learning interview question

rectangle overlap and a bfs question