Given a set of points in the xy-plane, determine the minimum area of a rectangle formed from these points, with sides parallel to the x and y axes.
If there isn't any rectangle, return 0.
Example 1:
Input: [[1,1],[1,3],[3,1],[3,3],[2,2]]
Output: 4
Example 2:
Input: [[1,1],[1,3],[3,1],[3,3],[4,1],[4,3]]
Output: 2
Note:
1 <= points.length <= 500
0 <= points[i][0] <= 40000
0 <= points[i][1] <= 40000
All points are distinct.
class Solution:
    def minAreaRect(self, points: List[List[int]]) -> int:
        min_area = float(\"inf\")
        points_table = set()
        for p in points:
            points_table.add(tuple(p))
        
        for x1, y1 in points:
            for x2, y2 in points:
                if x2 > x1 and y2 > y1:
                    if (x1, y2) in points_table and (x2, y1) in points_table:
                        area = abs(x1 - x2) * abs(y1 - y2)
                        if area:
                            min_area = min(min_area, area)
        return 0 if min_area == float(\"inf\") else min_area
class Solution:
    def minAreaRect(self, points: List[List[int]]) -> int:
        min_area = float(\"inf\")
        points_table = set()
        for p in points:
            points_table.add(tuple(p))
        
        for x1, y1 in points:
            for x2, y2 in points:
                if x2 > x1 and y2 > y1:
                    if (x1, y2) in points_table and (x2, y1) in points_table:
                        area = abs(x1 - x2) * abs(y1 - y2)
                        if area:
                            min_area = min(min_area, area)
        return 0 if min_area == float(\"inf\") else min_area