Why I can't pass this case?


  • 0
    H

    class Solution {
    public:
    int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
    int lengthA = C - A, heightA = D - B, lengthB = G - E, heightB = H - F;
    int area = lengthAheightA + lengthBheightB;
    int resLength = min(G, C) - max(A, E);
    int resHeight = min(D, H) - max(B, F);
    if (resLength <= 0 || resHeight <= 0)
    return area;
    else
    return area - resLength*resHeight;
    }

    -1500000001
    0
    -1500000000
    1
    1500000000
    0
    1500000001
    1

    Why I can't pass this case?


Log in to reply
 

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