Java Clean Solution | Weekly Contest
Complexity\n- Time complexity:O(n^2)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity:$$O(n^2)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public long largestSquareArea(int[][] bottomLeft, int[][] topRight) {\n        int len = bottomLeft.length;\n        long ans = 0;\n        for (int i = 0; i < len; i++) {\n            for (int j = i + 1; j < len; j++) {\n                int ilx = bottomLeft[i][0];\n                int ily = bottomLeft[i][1];\n                int irx = topRight[i][0];\n                int iry = topRight[i][1];\n\n                int jlx = bottomLeft[j][0];\n                int jly = bottomLeft[j][1];\n                int jrx = topRight[j][0];\n                int jry = topRight[j][1];\n\n                int lx = Math.max(ilx, jlx);\n                int ly = Math.max(ily, jly);\n                int rx = Math.min(irx, jrx);\n                int ry = Math.min(iry, jry);\n\n                if (lx < rx && ly < ry) {\n                    long side = Math.min(rx - lx, ry - ly);\n                    ans = Math.max(ans, side * side);\n                }\n            }\n        }\n\n        return ans;\n    }\n}\n```
['Array', 'Math', 'Matrix', 'Java']