Skip to content

Latest commit

 

History

History
58 lines (35 loc) · 1.42 KB

File metadata and controls

58 lines (35 loc) · 1.42 KB

中文文档

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 (A, B) and its top-right corner (C, D).

The second rectangle is defined by its bottom-left corner (E, F) and its top-right corner (G, H).

 

Example 1:

Rectangle Area

Input: A = -3, B = 0, C = 3, D = 4, E = 0, F = -1, G = 9, H = 2
Output: 45

Example 2:

Input: A = -2, B = -2, C = 2, D = 2, E = -2, F = -2, G = 2, H = 2
Output: 16

 

Constraints:

  • -104 <= A, B, C, D, E, F, G, H <= 104

Solutions

Python3

Java

...