Brute Force O(N^2) Approach ( no TLE ) to Solution, using intersection of two rectangles checking
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nBrute Force O(N^2) Approach ( no TLE ) to Solution, using intersection of
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nBrute Force O(N^2) Approach ( no TLE ) to Solution, using intersection of two rectangles checking.\nMake sure not to compute for cases where two rectangles do not intersection ( thus yielding an area of 0 ) when other pairwise combinations of rectangles would yield an actual positive minimal intersection for square area.\n\n# Complexity\n- Time complexity:\nLet N := #-rectangles\nTime = O(N^2)\n\n- Space complexity:\nSpace = O(1) ( Explicit ) O(1) ( implicit/recursive call stack )\n\n# Code\n```python3 []\n# URL := https://leetcode.com/problems/find-the-largest-area-of-square-inside-two-rectangles/description/\n# 3047. Find the Largest Area of Square Inside Two Rectangles\n# 1000 rectangles at max : 10e6 pairwise intersections to compute\n# Do inefficiency issues with O(pow(n,2)) arise up in compute?\nclass Solution:\n    def largestSquareArea(self, bottomLeft: List[List[int]], topRight: List[List[int]]) -> int:\n        lsa = 0\n        n = len(bottomLeft)\n        for i in range(n):\n            for j in range(i+1,n,1):\n                rectOne = [bottomLeft[i][0], bottomLeft[i][1], topRight[i][0], topRight[i][1]]\n                rectTwo = [bottomLeft[j][0], bottomLeft[j][1], topRight[j][0], topRight[j][1]]\n                rectIntersect = self.getIntersectRect(rectOne,rectTwo)\n                if(len(rectIntersect) == 4):\n                    xLen = abs(rectIntersect[2] - rectIntersect[0])\n                    yLen = abs(rectIntersect[1] - rectIntersect[3])\n                    squareLen = min(xLen,yLen)\n                    # pow() optimized over * operator?\n                    lsa = max(lsa, pow(squareLen,2))\n        return lsa\n\n    # in form (x1,y1,x2,y2)\n    def getIntersectRect(self,rectOne:List[int], rectTwo:List[int]) -> int:\n        x1 = max(rectOne[0], rectTwo[0])\n        x2 = min(rectOne[2], rectTwo[2])\n        y1 = max(rectOne[1], rectTwo[1])\n        y2 = min(rectOne[3], rectTwo[3])\n        if(x1 <= x2 and y1 <= y2):\n            targetRect = [x1,y1,x2,y2]\n        else:\n            targetRect = []\n        return targetRect\n        \n```
['Array', 'Math', 'Geometry', 'Python3']