classSolution{ /** * 数组 */ publicbooleanisRectangleCover(int[][] rectangles){ int left = Integer.MAX_VALUE; int right = Integer.MIN_VALUE; int top = Integer.MIN_VALUE; int bottom = Integer.MAX_VALUE;
int n = rectangles.length;
HashSet<String> set = new HashSet<>(); int sumArea = 0;
for (int i = 0; i < n; i++) { int tempLeft = rectangles[i][0]; int tempBottom = rectangles[i][1]; int tempRight = rectangles[i][2]; int tempTop = rectangles[i][3];
// 标记最外圈的顶点,完美矩形的顶点总应该在最外圈 left = Math.min(left, tempLeft); bottom = Math.min(bottom, tempBottom); right = Math.max(right, tempRight); top = Math.max(top, tempTop);