# 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.

- Take

`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:`

1 | Input: ax1 = -3, ay1 = 0, ax2 = 3, ay2 = 4, bx1 = 0, by1 = -1, bx2 = 9, by2 = 2 |

`Code:`

1 | /** |