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.
在坐标中,求两个长方形的总面积
代码:
参考代码
解题思路:分别求两个长方形的面积,然后看两个长方形是否相交,如果不相交,直接返回面积和;如果相交,求出相交面积。