Find the total area covered by two rectilinear rectangles in a 2D plane


  • 0
    O

    Hi Guys,

    My solution fails this test case. Could you tell me what is wrong. It seems the Expected is wrong the rectangles should not overlap with this as input -2, -2, 2, 2, 3, 3, 4, 4 ????

    Can someone tell me what could be wrong ?

    Input:
    -2, -2, 2, 2, 3, 3, 4, 4
    Output:
    0
    Expected:
    17


  • 0

    Well, 16 + 1 really is 17, not 0.


  • 0
    O

    Ahh, Although two rectanagles do not overlap each other at all. :)

    I guess I have understood the question wrong. Probably when they dont overlap have to return the sum of two areas.


Log in to reply
 

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