# Minimum Area Rectangle (Leetcode 939)

Problem Link: <https://leetcode.com/problems/minimum-area-rectangle/>

```python
class Solution:
    def minAreaRect(self, points: List[List[int]]) -> int:
        
        visited=set()
        ans=float('inf')
        for x1,y1 in points:
            for x2,y2 in visited:
                if((x1,y2) in visited and (x2,y1) in visited):
                    ans=min(ans,abs(y2-y1)*abs(x2-x1))
                
            visited.add((x1,y1))
        
        if(ans==float('inf')):
            return 0
        else:
            return ans
```
