problem223

package
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 0 Imported by: 0

README

< Previous                  Next >

223. Rectangle Area (Medium)

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

[Math]

Similar Questions

  1. Rectangle Overlap (Easy)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL