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.
![Rectangle Area](https://leetcode.com/static/images/problemset/rectangle_area.png)
Assume that the total area is never beyond the maximum possible value of int.
1 public class Solution { 2 public int ComputeArea(int A, int B, int C, int D, int E, int F, int G, int H) { 3 int area1 = (C - A) * (D - B), area2 = (G - E) * (H - F); 4 5 if (C <= E || D <= F || A >= G || B >= H) 6 { 7 return area1 + area2; 8 } 9 else 10 { 11 return area1 + area2 - (Math.Min(C, G) - Math.Max(A, E)) * (Math.Min(D, H) - Math.Max(B, F)); 12 } 13 } 14 }