# Leetcode 223 - Rectangle area

Note:

• It’s easy to get areas of A and B.
• How to find their overlapped area?
• Take width for example, if they are overlapped, then Math.min(ax2, bx2) - Math.max(ax1, bx1) > 0. Otherwise it’s negative.

Question:

Given the coordinates of two rectilinear rectangles in a 2D plane, return the total area covered by the two rectangles.

The first rectangle is defined by its bottom-left corner (ax1, ay1) and its top-right corner (ax2, ay2).

The second rectangle is defined by its bottom-left corner (bx1, by1) and its top-right corner (bx2, by2).

Example:

Code: