Basic solution by Arun
Intuition\n Describe your first thoughts on how to solve this problem. \nn max constraint is 1000 only. So, we can go to n^2 order time compexity.\n\n# Approach
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nn max constraint is 1000 only. So, we can go to n^2 order time compexity.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nFind function two get area of square(maximum area) of common region. \n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n^2)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n\n    int common_edge(int x1,int x2, int x3, int x4){\n        if ( x3 < x1 ){\n            if(x4 < x1)return 0;\n            else if (x4 < x2 )return abs(x4-x1);\n            else return abs(x2-x1);\n        }\n        else if (x3 < x2 ) {\n            if( x4 < x2 )return abs(x4-x3);\n            else return abs(x2-x3);\n        }\n        else return 0;\n    }\n\n    long long common_area_of_two_rectangle(pair<int,int> rec1_p1, pair<int,int> rec1_p2,pair<int,int> rec2_p1, pair<int,int> rec2_p2){\n        int x1,x2,x3,x4,y1,y2,y3,y4;\n        // first rectangel points\n        x1 = rec1_p1.first;\n        x2 = rec1_p2.first;\n        y1 = rec1_p1.second;\n        y2 = rec1_p2.second;\n        // second rectangel points\n        x3 = rec2_p1.first;\n        x4 = rec2_p2.first;\n        y3 = rec2_p1.second;\n        y4 = rec2_p2.second;\n        // cout<<"width common is "<<common_edge(x1,x2,x3,x4)<<"\\n";\n        // cout<<"height common is "<<common_edge(y1,y2,y3,y4)<<"\\n";\n        int square_side = min(common_edge(x1,x2,x3,x4), common_edge(y1,y2,y3,y4));\n        return square_side*1LL*square_side;\n\n    }\n    long long largestSquareArea(vector<vector<int>>& bottomLeft, vector<vector<int>>& topRight) {\n        int n = bottomLeft.size();\n        long long ans=0;\n        for(int i=0;i<n-1;i++){\n            for(int j=i+1;j<n;j++){\n              pair<int,int>rec1_p1,rec1_p2;\n              pair<int,int>rec2_p1,rec2_p2;\n              // rectangel 1 \n              rec1_p1.first = bottomLeft[i][0];\n              rec1_p1.second = bottomLeft[i][1];\n              rec1_p2.first = topRight[i][0];\n              rec1_p2.second = topRight[i][1];\n              // rectangel 2\n              rec2_p1.first = bottomLeft[j][0];\n              rec2_p1.second = bottomLeft[j][1];\n              rec2_p2.first = topRight[j][0];\n              rec2_p2.second = topRight[j][1];\n\n              long long common_area = common_area_of_two_rectangle(rec1_p1,rec1_p2, rec2_p1,rec2_p2);\n            //   cout<<"first common area is "<<common_area<<"\\n";\n              ans = max(ans, common_area);\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']