1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最小面积矩形 II [minimum-area-rectangle-ii].html
2022-03-29 12:43:11 +08:00

53 lines
2.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定在 xy 平面上的一组点,确定由这些点组成的任何矩形的最小面积,其中矩形的边<strong>不一定平行于</strong> x 轴和 y 轴。</p>
<p>如果没有任何矩形,就返回 0。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<p><strong><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/12/22/1a.png" style="height: 151px; width: 150px;"></strong></p>
<pre><strong>输入:</strong>[[1,2],[2,1],[1,0],[0,1]]
<strong>输出:</strong>2.00000
<strong>解释:</strong>最小面积的矩形出现在 [1,2],[2,1],[1,0],[0,1] 处,面积为 2。</pre>
<p><strong>示例 2</strong></p>
<p><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/12/23/2.png" style="height: 94px; width: 150px;"></p>
<pre><strong>输入:</strong>[[0,1],[2,1],[1,1],[1,0],[2,0]]
<strong>输出:</strong>1.00000
<strong>解释:</strong>最小面积的矩形出现在 [1,0],[1,1],[2,1],[2,0] 处,面积为 1。
</pre>
<p><strong>示例 3</strong></p>
<p><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/12/23/3.png" style="height: 94px; width: 150px;"></p>
<pre><strong>输入:</strong>[[0,3],[1,2],[3,1],[1,3],[2,1]]
<strong>输出:</strong>0
<strong>解释:</strong>没法从这些点中组成任何矩形。
</pre>
<p><strong>示例 4</strong></p>
<p><strong><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/12/21/4c.png" style="height: 155px; width: 160px;"></strong></p>
<pre><strong>输入:</strong>[[3,1],[1,1],[0,1],[2,1],[3,3],[3,2],[0,2],[2,3]]
<strong>输出:</strong>2.00000
<strong>解释:</strong>最小面积的矩形出现在 [2,1],[2,3],[3,3],[3,1] 处,面积为 2。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ol>
<li><code>1 &lt;= points.length &lt;= 50</code></li>
<li><code>0 &lt;=&nbsp;points[i][0] &lt;=&nbsp;40000</code></li>
<li><code>0 &lt;=&nbsp;points[i][1] &lt;=&nbsp;40000</code></li>
<li>所有的点都是不同的。</li>
<li>与真实值误差不超过 <code>10^-5</code>&nbsp;的答案将视为正确结果。</li>
</ol>