We know that a rectangle can be represented using two coordinates, the top left corner, and the bottom right corner. Suppose there are two rectangles, we have to check whether these two overlap or not. There are four coordinate points (l1, r1) and (l2, r2).
We have assumed that the rectangles are parallel to the coordinate axes.
To solve this, we have to check a few conditions.
Comments