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

存量题库数据更新

This commit is contained in:
2023-12-09 18:42:21 +08:00
parent a788808cd7
commit c198538f10
10843 changed files with 288489 additions and 248355 deletions

View File

@@ -1,30 +1,30 @@
<p>假设有一个很长的花坛,一部分地块种植了花,另一部分却没有。可是,花不能种植在相邻的地块上,它们会争夺水源,两者都会死去。</p>
<p>给你一个整数数组  <code>flowerbed</code> 表示花坛,由若干 <code>0</code><code>1</code> 组成,其中 <code>0</code> 表示没种植花,<code>1</code> 表示种植了花。另有一个数 <code>n</code><strong> </strong>,能否在不打破种植规则的情况下种入 <code>n</code><strong> </strong>朵花?能则返回 <code>true</code> ,不能则返回 <code>false</code></p>
<p>给你一个整数数组&nbsp;<code>flowerbed</code> 表示花坛,由若干 <code>0</code><code>1</code> 组成,其中 <code>0</code> 表示没种植花,<code>1</code> 表示种植了花。另有一个数&nbsp;<code>n</code><strong> </strong>,能否在不打破种植规则的情况下种入&nbsp;<code>n</code><strong>&nbsp;</strong>朵花?能则返回 <code>true</code> ,不能则返回 <code>false</code>&nbsp;</p>
<p> </p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<p><strong class="example">示例 1</strong></p>
<pre>
<strong>输入:</strong>flowerbed = [1,0,0,0,1], n = 1
<strong>输出:</strong>true
</pre>
<p><strong>示例 2</strong></p>
<p><strong class="example">示例 2</strong></p>
<pre>
<strong>输入:</strong>flowerbed = [1,0,0,0,1], n = 2
<strong>输出:</strong>false
</pre>
<p> </p>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= flowerbed.length <= 2 * 10<sup>4</sup></code></li>
<li><code>1 &lt;= flowerbed.length &lt;= 2 * 10<sup>4</sup></code></li>
<li><code>flowerbed[i]</code><code>0</code><code>1</code></li>
<li><code>flowerbed</code> 中不存在相邻的两朵花</li>
<li><code>0 <= n <= flowerbed.length</code></li>
</ul>
<li><code>0 &lt;= n &lt;= flowerbed.length</code></li>
</ul>