1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 19:31:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

add leetcode problem-cn part5

This commit is contained in:
2022-03-27 20:52:13 +08:00
parent 053330914a
commit c11d601602
326 changed files with 26353 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
<p>冬季已经来临。 你的任务是设计一个有固定加热半径的供暖器向所有房屋供暖。</p>
<p>在加热器的加热半径范围内的每个房屋都可以获得供暖。</p>
<p>现在,给出位于一条水平线上的房屋 <code>houses</code> 和供暖器 <code>heaters</code> 的位置,请你找出并返回可以覆盖所有房屋的最小加热半径。</p>
<p><strong>说明</strong>:所有供暖器都遵循你的半径标准,加热的半径也一样。</p>
<p> </p>
<p><strong>示例 1:</strong></p>
<pre>
<strong>输入:</strong> houses = [1,2,3], heaters = [2]
<strong>输出:</strong> 1
<strong>解释:</strong> 仅在位置2上有一个供暖器。如果我们将加热半径设为1那么所有房屋就都能得到供暖。
</pre>
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong> houses = [1,2,3,4], heaters = [1,4]
<strong>输出:</strong> 1
<strong>解释:</strong> 在位置1, 4上有两个供暖器。我们需要将加热半径设为1这样所有房屋就都能得到供暖。
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>houses = [1,5], heaters = [2]
<strong>输出:</strong>3
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= houses.length, heaters.length <= 3 * 10<sup>4</sup></code></li>
<li><code>1 <= houses[i], heaters[i] <= 10<sup>9</sup></code></li>
</ul>