1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-13 01:15:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2025-09-29 14:43:44 +08:00
parent 2862a227c4
commit 13f2098086
4409 changed files with 168933 additions and 166256 deletions

View File

@@ -1,26 +1,33 @@
<p>给定一个二进制数组 <code>nums</code> , 找到含有相同数量的 <code>0</code><code>1</code> 的最长连续子数组,并返回该子数组的长度。</p>
<p> </p>
<p>&nbsp;</p>
<p><strong>示例 1:</strong></p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong> nums = [0,1]
<strong>输出:</strong> 2
<strong>说明:</strong> [0, 1] 是具有相同数量 0 和 1 的最长连续子数组。</pre>
<strong>输入</strong>nums = [0,1]
<strong>输出</strong>2
<strong>说明</strong>[0, 1] 是具有相同数量 0 和 1 的最长连续子数组。</pre>
<p><strong>示例 2:</strong></p>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong> nums = [0,1,0]
<strong>输出:</strong> 2
<strong>说明:</strong> [0, 1] (或 [1, 0]) 是具有相同数量0和1的最长连续子数组。</pre>
<strong>输入</strong>nums = [0,1,0]
<strong>输出</strong>2
<strong>说明</strong>[0, 1] (或 [1, 0]) 是具有相同数量 0 和 1 的最长连续子数组。</pre>
<p> </p>
<p><strong>示例 3</strong></p>
<pre>
<b>输入:</b>nums = [0,1,1,1,1,1,0,0,0]
<b>输出:</b>6
<b>解释:</b>[1,1,1,0,0,0] 是具有相同数量 0 和 1 的最长连续子数组。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>nums[i]</code> 不是 <code>0</code> 就是 <code>1</code></li>
</ul>