223. Rectangle Area

Find the total area covered by two rectilinear rectangles in a 2D plane.

Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.

Rectangle Area

Example:

Note:

Assume that the total area is never beyond the maximum possible value of int.

解题要点:

相交部分分成左右,上下四个点处理,如以下。

Last updated