NOTE: This problem statement contains an image that may not display properly if viewed outside of the applet.
Given a list of two-dimensional rectangles, compute the area of their union. For example, the union of the three rectangles shown in the figure below:
cover an area of 35 units.
The list of rectangles will be given as a String[], where each element describes one rectangle. Each String will be formatted as 4 space-separated integers with no leading zeros, giving the coordinates of the left, bottom, right, and top of the rectangle (in that order). The three rectangles shown above would be given as:
{ "1 3 5 6",
"3 1 7 5",
"4 4 9 7" }
|