963. Minimum Area Rectangle II
Practice Minimum Area Rectangle II 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 any rectangle whose four corners are in points. The sides do not have to be parallel to the axes. Return 0 if there is no rectangle. Answers within 1e-5 are accepted.
Example
points = [[1,2],[2,1],[1,0],[0,1]] -> 2.0
points = [[0,1],[2,1],[1,1],[1,0],[2,0]] -> 1.0
points = [[0,3],[1,2],[3,1],[1,3],[2,1]] -> 0
Constraints
- 1 <= points.length <= 50
- 0 <= x, y <= 4 * 10^4; all points are distinct