My Solution

  • 0

    """public class Solution {
    public int computeArea(int _A, int _B, int _C, int _D, int _E, int _F, int _G, int _H) {
    long A= 0;
    long B=0;
    long C=(long)_C-(long)_A;
    long D=(long)_D-(long)_B;
    long E=(long)_E-(long)_A;
    long F=(long)_F-(long)_B;
    long G=(long)_G-(long)_A;
    long H=(long)_H-(long)_B;
    if(F>=D || G<=A || H<=B ||E>=C) return 0;
    long hight=Math.min(D,H);
    long width=Math.min(C,G)-Math.max(A,E);
    return (int)(hight*width);

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.