mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-11 10:21:43 +08:00
存量题库数据更新
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<p>我们给出了一个(轴对齐的)二维矩形列表 <code>rectangles</code> 。 对于 <code>rectangle[i] = [x1, y1, x2, y2]</code>,其中(x1,y1)是矩形 <code>i</code> 左下角的坐标,<meta charset="UTF-8" /> <code>(x<sub>i1</sub>, y<sub>i1</sub>)</code> 是该矩形 <strong>左下角</strong> 的坐标,<meta charset="UTF-8" /> <code>(x<sub>i2</sub>, y<sub>i2</sub>)</code> 是该矩形 <strong>右上角</strong> 的坐标。</p>
|
||||
<p>给你一个轴对齐的二维数组 <code>rectangles</code> 。 对于 <code>rectangle[i] = [x1, y1, x2, y2]</code>,其中(x1,y1)是矩形 <code>i</code> 左下角的坐标,<meta charset="UTF-8" /> <code>(x<sub>i1</sub>, y<sub>i1</sub>)</code> 是该矩形 <strong>左下角</strong> 的坐标,<meta charset="UTF-8" /> <code>(x<sub>i2</sub>, y<sub>i2</sub>)</code> 是该矩形 <strong>右上角</strong> 的坐标。</p>
|
||||
|
||||
<p>计算平面中所有 <code>rectangles</code> 所覆盖的 <strong>总面积 </strong>。任何被两个或多个矩形覆盖的区域应只计算 <strong>一次</strong> 。</p>
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<p><img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/06/06/rectangle_area_ii_pic.png" style="height: 300px; width: 400px;" /></p>
|
||||
<p><img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/06/06/rectangle_area_ii_pic.png" style="height: 360px; width: 480px;" /></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>rectangles = [[0,0,2,2],[1,0,2,3],[1,0,3,1]]
|
||||
<strong>输出:</strong>6
|
||||
<strong>解释:</strong>如图所示,三个矩形覆盖了总面积为6的区域。
|
||||
<strong>解释:</strong>如图所示,三个矩形覆盖了总面积为 6 的区域。
|
||||
从(1,1)到(2,2),绿色矩形和红色矩形重叠。
|
||||
从(1,0)到(2,3),三个矩形都重叠。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>rectangles = [[0,0,1000000000,1000000000]]
|
||||
@@ -34,5 +34,4 @@
|
||||
<li><code>1 <= rectangles.length <= 200</code></li>
|
||||
<li><code>rectanges[i].length = 4</code><meta charset="UTF-8" /></li>
|
||||
<li><code>0 <= x<sub>i1</sub>, y<sub>i1</sub>, x<sub>i2</sub>, y<sub>i2</sub> <= 10<sup>9</sup></code></li>
|
||||
<li>矩形叠加覆盖后的总面积不会超越 <code>2^63 - 1</code> ,这意味着可以用一个 64 位有符号整数来保存面积结果。</li>
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user