Referring https://leetcode.com/problems/rectangle-area/

Submission Result: Wrong Answer More Details

- Rectangle Area My Submissions QuestionEditorial Solution

Total Accepted: 40654 Total Submissions: 133524 Difficulty: Easy

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

Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.

Rectangle Area

Assume that the total area is never beyond the maximum possible value of int.

Input:

0

0

0

0

-1

-1

1

1

Output:

0

Expected:

4

Why is the expected output "4"?