Easy Java code
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach calculate max length of square that can be fitted from every possible comb
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach calculate max length of square that can be fitted from every possible combination\n<!-- Describe your approach to solving the problem. -->\n\n# 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    long maxsquarePossible(int ax1, int ay1, int ax2, int ay2, int bx1, int by1, int bx2, int by2){\n        if(ax1>=bx2 || ay1>=by2 || ay2<=by1 || ax2<=bx1)\n        return 0;\n        \n        int cx1=Math.max(ax1,bx1);\n        int cx2=Math.min(ax2,bx2);\n        int cy1=Math.max(ay1,by1);\n        int cy2=Math.min(ay2,by2);\n\n        return Math.min(cx2-cx1, cy2-cy1);\n    }\n\n    public long largestSquareArea(int[][] bottomLeft, int[][] topRight) {\n        int n=bottomLeft.length;\n        long ans=0;\n        for(int i=0;i<n-1;i++){\n            for(int j=i+1;j<n;j++){\n                long temp=maxsquarePossible(bottomLeft[i][0],bottomLeft[i][1],topRight[i][0],topRight[i][1], bottomLeft[j][0],bottomLeft[j][1],topRight[j][0],topRight[j][1]);\n                if(temp>ans)\n                ans=temp;\n\n            }\n        }\n        return (ans*ans);\n    }\n}\n```
['Java']