Skip to main content
LeetCode 963, Medium. Topics: Array, Hash Table, Math, Geometry. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 22 parametrized pytest cases, and a playground notebook:

Problem

You are given an array of points in the X-Y plane points where points[i] = [x<sub>i</sub>, y<sub>i</sub>]. Return the minimum area of any rectangle formed from these points, with sides not necessarily parallel to the X and Y axes. If there is not any such rectangle, return 0. Answers within 10<sup>-5</sup> of the actual answer will be accepted.

Examples

Example 1
Example 2
Example 3

Constraints

  • 1 <= points.length <= 50
  • points[i].length == 2
  • 0 <= xi, yi <= 4 * 10^4
  • All the given points are unique.

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

Last modified on September 7, 2026