0223. Rectangle Area

https://leetcode.com/problems/rectangle-area

Description

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:

Rectangle Area

Example 2:

Constraints:

  • -104 <= ax1, ay1, ax2, ay2, bx1, by1, bx2, by2 <= 104

ac

Last updated

Was this helpful?