Find min of intersection of x & y sides
\n\n# Approach\n- Need to check each combination of rectangle and check the minimum length of the overlapping section. For this we check the x direction interse
\n\n# Approach\n- Need to check each combination of rectangle and check the minimum length of the overlapping section. For this we check the x direction intersection and y direction intersection. Then take the minimum\n- Iterate over two loops to get the combination of each pair of rectangle.\n- To get the intersection we have four different cases :\n  - When jth rectangle enclose the ith rectangle\n  - When ith rectangle enclose the jth rectangle\n  - ith right side is in between jth two sides\n  - ith left side is in between jth tow sides\n  \n\n# Complexity\n- Time complexity: O(N * N)\n- Space complexity: O(1)\n\n# Code\n```\nlong long getIntersection(int l1, int r1, int l2, int r2){\n    if(l2 <= l1 && r2 >= r1 ) { return r1 - l1; }\n    if(l1 <= l2 && r1 >= r2 ) { return r2 - l2; }\n    if(l2 <= r1 && r2 >= r1 ) { return r1 - l2; }\n    if(l2 <= r1 && r2 >= l1 ) { return r2 - l1; }\n    return 0;\n}\n\nlong long largestSquareArea(vector<vector<int>>& bottomLeft, vector<vector<int>>& topRight) {\n    long long ans = 0;\n    for(int i = 0; i < bottomLeft.size(); ++i){\n        for(int j = i + 1; j < topRight.size(); ++j ){\n            long long x = getIntersection(bottomLeft[i][0], topRight[i][0], bottomLeft[j][0], topRight[j][0]);  // x side intersection\n            long long y = getIntersection(bottomLeft[i][1], topRight[i][1], bottomLeft[j][1], topRight[j][1]);  // y side intersection\n            ans = max(ans, min(x, y));\n        }\n    }\n    return ans * ans;\n}\n```\n\n\n---\n\n\n<b>Here is an article of my interview experience at Amazon, taht may be helpful for you : \nhttps://leetcode.com/discuss/interview-experience/3171859/Journey-to-a-FAANG-Company-Amazon-or-SDE2-(L5)-or-Bangalore-or-Oct-2022-Accepted\n\n---\n\n
['C++']