I have to say, this question is stupid to set int as parameter type for JAVA


  • 0
    A
    public class Solution {
    public int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
        return (D-B)*(C-A) + (G-E)*(H-F) -  (int)Math.max((long)Math.min(C, G) - (long)Math.max(A, E), 0) * (int)Math.max((long)Math.min(D, H) - (long)Math.max(B, F), 0);
    }
    

    }

    And they give test case which would exceed int range. Waste of time


Log in to reply
 

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