3047. Find the Largest Area of Square Inside Two Rectangles in Java by Coding_Sanjay
\n# Code\n\nclass Solution {\n    public long largestSquareArea(int[][] bottomLeft, int[][] topRight) {\n        \n        long ans = 0;\n\n        for (int i=0
\n# Code\n```\nclass Solution {\n    public long largestSquareArea(int[][] bottomLeft, int[][] topRight) {\n        \n        long ans = 0;\n\n        for (int i=0; i<bottomLeft.length; i++) {\n            for (int j=i+1; j<bottomLeft.length; j++) {\n\n                int xl = Math.max(bottomLeft[i][0], bottomLeft[j][0]);\n                int xh = Math.min(topRight[i][0], topRight[j][0]);\n\n                int yl = Math.max(bottomLeft[i][1], bottomLeft[j][1]);\n                int yh = Math.min(topRight[i][1], topRight[j][1]);\n\n                int xlen = Math.max(xh - xl, 0);\n                int ylen = Math.max(yh - yl, 0);\n\n                long dim = Math.min(xlen, ylen);\n                ans = Math.max(ans, dim*dim);\n            }\n        }\n\n        return ans;\n    }\n}\n```
['Java']