963. Minimum Area Rectangle II Medium
1/**
2 * [963] Minimum Area Rectangle II
3 *
4 * You are given an array of points in the X-Y plane points where points[i] = [xi, yi].
5 * 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.
6 * Answers within 10^-5 of the actual answer will be accepted.
7 *
8 * Example 1:
9 * <img alt="" src="https://assets.leetcode.com/uploads/2018/12/21/1a.png" style="width: 398px; height: 400px;" />
10 * Input: points = [[1,2],[2,1],[1,0],[0,1]]
11 * Output: 2.00000
12 * Explanation: The minimum area rectangle occurs at [1,2],[2,1],[1,0],[0,1], with an area of 2.
13 *
14 * Example 2:
15 * <img alt="" src="https://assets.leetcode.com/uploads/2018/12/22/2.png" style="width: 400px; height: 251px;" />
16 * Input: points = [[0,1],[2,1],[1,1],[1,0],[2,0]]
17 * Output: 1.00000
18 * Explanation: The minimum area rectangle occurs at [1,0],[1,1],[2,1],[2,0], with an area of 1.
19 *
20 * Example 3:
21 * <img alt="" src="https://assets.leetcode.com/uploads/2018/12/22/3.png" style="width: 383px; height: 400px;" />
22 * Input: points = [[0,3],[1,2],[3,1],[1,3],[2,1]]
23 * Output: 0
24 * Explanation: There is no possible rectangle to form from these points.
25 *
26 *
27 * Constraints:
28 *
29 * 1 <= points.length <= 50
30 * points[i].length == 2
31 * 0 <= xi, yi <= 4 * 10^4
32 * All the given points are unique.
33 *
34 */
35pub struct Solution {}
36
37// problem: https://leetcode.com/problems/minimum-area-rectangle-ii/
38// discuss: https://leetcode.com/problems/minimum-area-rectangle-ii/discuss/?currentPage=1&orderBy=most_votes&query=
39
40// submission codes start here
41
42impl Solution {
43 pub fn min_area_free_rect(points: Vec<Vec<i32>>) -> f64 {
44 0f64
45 }
46}
47
48// submission codes end
49
50#[cfg(test)]
51mod tests {
52 use super::*;
53
54 #[test]
55 fn test_963() {
56 }
57}
58
Back
© 2025 bowen.ge All Rights Reserved.