Approach and C++ Code
Intuition\n Describe your first thoughts on how to solve this problem. \nThink to find the intersection portion of rectangles.\nThe portion formed by intersecti
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThink to find the intersection portion of rectangles.\nThe portion formed by intersection can be cosider as the rectangle.So, find the co-ordinates of that rectangle\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nFor finding intersection portion we eliminate the condition for which intersection is not possible.\nAs we have cordinates of bottom-left corners and top-right corners\nwe can conclude that the rectangle which lies outside valid range can not intersect. So, we process remaining cases and find the co-ordinates of bottom-left and top-right corner of rectangle formed by intersection.\nUsing that co-ordinates find the lenght and breadth of that rectangle.\nMinimum among the length and breadth of rectangle will be length of side of square.\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```\n#include <cmath>\n\nclass Solution {\npublic:\n    long long largestSquareArea(vector<vector<int>>& bottomLeft, vector<vector<int>>& topRight) {\n        // Fetch number of cordinates in either Bottom-left array or Top-right array\n        int n = bottomLeft.size();\n\n        // Create variable which store the size of square formed by intersection\n        long long ans = 0;\n        \n        // Traverse\n        for(int i = 0 ; i < n ; i++){\n\n            for(int j = i + 1 ; j < n ; j++ ){\n\n                // if rectangle\'s top-right corner lies beside bottom-left corner it indicates that they cannot intersect\n                if(topRight[j][0] <= bottomLeft[i][0] || topRight[j][1] <= bottomLeft[i][1])\n                    continue;\n\n                // if rectangle\'s bottom-left corner lies ahead top-right corner it indicates that they cannot intersect\n                if(topRight[i][0] <=  bottomLeft[j][0] || topRight[i][1] <=  bottomLeft[j][1])\n                    continue;\n\n                // find bottom-left corner co-ordinates of rectangle formed by intersection\n                int xa = max( bottomLeft[j][0],bottomLeft[i][0]);\n                int ya = max( bottomLeft[j][1],bottomLeft[i][1]);\n\n                // find top-right corner co-ordinates of rectangle formed by intersection\n                int xb = min(topRight[j][0],topRight[i][0]);\n                int yb = min(topRight[j][1],topRight[i][1]);\n\n                // Calculate length and breadth of intersected rectangle\n                long long ansa = (xb - xa);\n                long long ansb = (yb - ya);\n\n                // Minimum among the length and breadth indicates the side of square and then store the maximum size of square formed by intersection\n                ans = max(ans,min(ansa,ansb));\n            }\n        }\n\n        // Return Area\n        return ans * ans;\n    }\n};\n```
['C++']