classSolution: defminAreaRect(self, points): s = set() ubound = 40000*40000+1 ans = 40000*40000+1 for x1, y1 in points: for x2, y2 in s: if (x1, y2) in s and (x2, y1) in s: calc = abs(x1 - x2) * abs(y1 - y2) if calc and calc < ans: ans = calc s.add((x1, y1)) return0if ans==ubound else ans