939. Minimum Area Rectangle

Practice Minimum Area Rectangle for free on NudgeCode: Medium, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

points[i] = [x, y] are distinct points in the plane. Return the minimum area of a rectangle whose four corners are all in points and whose sides are parallel to the x and y axes. Return 0 if there is no such rectangle.

Example

points = [[1,1],[1,3],[3,1],[3,3],[2,2]]              ->  4
points = [[1,1],[1,3],[3,1],[3,3],[4,1],[4,3]]        ->  2

Constraints