Java, O(N^2), O(1) space.
Just iterate through every pair of rectangles, skipping any pairs that don\'t overlap by checking if the bottom end of one rectangle is above the top end of the
Just iterate through every pair of rectangles, skipping any pairs that don\'t overlap by checking if the bottom end of one rectangle is above the top end of the other or the left end of one is to the right of the right end of another. \n\nOnce it is confirmed that the rectangles do indeed overlap, find the x as well as the y overlap, as that will form the overlapping rectangle, then take the minimum of these two overlaps to form the overlapping square, as if a < b, an a x a square can fit inside an a x b rectangle, but a b x b square will not fit within an a x b rectangle. \n\nFind the max min dimension overlap from all pairs of overlapping points, and return that overlap squared to get the area of the square of side length = min overlap.\n\n# Code\n```\nclass Solution {\n    public long largestSquareArea(int[][] bottomLeft, int[][] topRight) {\n        int n = bottomLeft.length;\n        int maxSide = 0;\n        for(int i = 0; i < n; i++) {\n            for(int j = i+1; j < n; j++) {\n                if(bottomLeft[i][0] >= topRight[j][0] || bottomLeft[i][1] >= topRight[j][1] || bottomLeft[j][0] >= topRight[i][0] || bottomLeft[j][1] >= topRight[i][1]) continue;\n                int delX = Math.min(topRight[i][0], topRight[j][0])-Math.max(bottomLeft[i][0], bottomLeft[j][0]);\n                int delY = Math.min(topRight[i][1], topRight[j][1])-Math.max(bottomLeft[i][1], bottomLeft[j][1]);\n                maxSide = Math.max(maxSide, Math.min(delX, delY));\n            }\n        }\n        return (long)maxSide*maxSide;\n    }\n}\n```
['Geometry', 'Java']