IXL Learning Interview Question

rectangle overlap and a bfs question