C++ || O(N^2) || Basic geometry || Explanation
Intuition\nAll we need to do is to find the intersection of rectangles.\nSince the constrains give way to a brute force solution, we can fix a rectangle and che
# Intuition\nAll we need to do is to find the intersection of rectangles.\nSince the constrains give way to a brute force solution, we can fix a rectangle and check if other rectangles intersect with the current one. We do this for every rectangle. \n\n# Approach\nwhen you have two lines denoted by their start and end coordinates, how do you check if they intersect? One of the ways to check if there is an intersection is to use the following:\n`(s1, e1) => denotes the start and the end coordinates of the first line`\n`(s2, e2) => the start and the end coordinates of the second line`\n\nThere is an intersection iff the following is true:\n\n`Max(s1, s2) <= Min(e1, e2)`. \n\nYou can confirm that visually by drawing all the cases for two lines.\n\nFor a rectangle, we have two such lines: horizontal and vertical.\nWe check the intersection for both horizontal and vertical lines (the respective side of the rectangle).\n\n\n# Complexity\n- Time complexity:\n`O(N^2)`\n\n- Space complexity:\n`O(1)`\n\n# Code\n```\nclass Solution {\npublic:\n    long long largestSquareArea(vector<vector<int>>& bottomLeft, vector<vector<int>>& topRight) {\n        long long ans = 0;\n        int n = int(bottomLeft.size());\n\n        for(int i = 0; i < n; i++)\n        {\n            int x1_s = bottomLeft[i][0]; \n            int x1_e = topRight[i][0];\n            int y1_s = bottomLeft[i][1];\n            int y1_e = topRight[i][1];\n            for(int j = i + 1; j < n; j++)\n            {\n                int x2_s = bottomLeft[j][0];\n                int x2_e = topRight[j][0];\n                int y2_s = bottomLeft[j][1];\n                int y2_e = topRight[j][1];\n                //horizontal intersection\n                int h_s = std::max(x1_s, x2_s);\n                int h_e = std::min(x1_e, x2_e);\n                //vertical intersection\n                int v_s = std::max(y1_s, y2_s);\n                int v_e = std::min(y1_e, y2_e);\n\n                if((h_s < h_e) && (v_s < v_e))\n                {\n                    int side = std::min(h_e - h_s, v_e - v_s);\n                    ans = std::max(ans, (long long)side * side);\n                }\n                \n            }\n\n        }\n\n        return ans;\n    }\n};\n```
['C++']