There's a very long road along y-axis, bounded between x-axis from [0, 100]
A driver tries to drive from the start of this road to the end.
Given a list of rectangle blockers, will the driver be able to make it to the end?
Rectangles are parallel to x and y axis. They are represented by 4 floats (bottom_left_x, bottom_left_y, top_right_x, top_right_y)
In both these example, the driver cannot drive from start to end. So return false:


However, if in the first example, if either A or B or C was missing, the driver would have been able to cross the road.
I was initially struggling with trying to merge x-intervals and y-intervals, find overlapping intervals and so on... I was trying to determine if there's a line parallel to the x-axis which is completely blocked by the rectangular blocks.
Hint by the interviewer: We can say that the road is blocked completely by the rectangular blocks, if we can walk from x = 0 to x = 100.
I picked up on this hint - It's a path finding problem. All blocks touching/intersecting with x=0 are "source" nodes and all those with x=100 are "destination" nodes. Overlapping/touching blocks are neighbors. Use bfs to find if there's any path from any source to any destination.