publicclassSolution{ publicintcomputeArea(int A, int B, int C, int D, int E, int F, int G, int H){ int s1 = (C - A) * (D - B); int s2 = (G - E) * (H - F); int left = Math.max(A, E); int right = Math.min(G, C); int top = Math.min(D, H); int bottom = Math.max(B, F); int common = 0; if(right > left && top > bottom) common = (right - left) * (top - bottom); return s1 + s2 - common; } }