# leetcode-223 Rectangle Area

Find the total area covered by two rectilinear rectangles in a 2D plane.

Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.

Assume that the total area is never beyond the maximum possible value of int.

class Solution {
public:
int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
int s1=0, s2=0, s=0;
int  s3=0 ;
s1 = (C-A)*(D-B);
s2 = (G-E)*(H-F);
if(A >= G || B >= H || E >= C || F >= D)
s3=0;
else
{
int I, J , K , L;
I = A > E ? A : E;
J = B > F ? B : F;
K = C < G ? C : G;
L = D < H ? D : H;
s3 = (K-I)*(L-J);
}
s = s1+s2-s3;
return s;
}
};

#### 【LeetCode-223】 Rectangle Area(C++)

2016-05-11 22:20:23

#### [leetcode-223]Rectangle Area(c++)

2015-08-25 10:09:39

#### leetcode 223: Rectangle Area

2015-06-10 03:25:56

#### 【LeetCode-面试算法经典-Java实现】【223-Rectangle Area（矩形区域）】

2015-08-29 06:39:48

#### [LintCode]Rectangle Area(Java)

2017-08-05 15:19:05

#### 223. Rectangle Area [easy] (Python)

2016-06-15 11:24:21

#### leetcode -- Rectangle Area -- 看看计算公式

2015-12-03 12:46:36

#### Q74：面积光源（Area Light）

2017-03-02 14:20:10

#### leetCode 之 Rectangle Area

2015-06-09 23:34:08

#### (java)Rectangle Area

2015-12-17 19:29:34